本文整理了Java中php.runtime.Memory.assign()
方法的一些代码示例,展示了Memory.assign()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Memory.assign()
方法的具体详情如下:
包路径:php.runtime.Memory
类名称:Memory
方法名:assign
[英]Static
[中]静止的
代码示例来源:origin: jphp-group/jphp
@Signature
public Memory __debugInfo(Environment env, Memory... args) {
ArrayMemory r = new ArrayMemory();
r.refOfIndex("*id").assign(thread.getId());
r.refOfIndex("*name").assign(thread.getName());
if (thread.getThreadGroup() != null)
r.refOfIndex("*group").assign(thread.getThreadGroup().getName());
else
r.refOfIndex("*group");
r.refOfIndex("*priority").assign(thread.getPriority());
return r.toConstant();
}
代码示例来源:origin: jphp-group/jphp
@Signature
public Memory __debugInfo(Environment env, Memory... args) {
ArrayMemory r = new ArrayMemory();
r.refOfIndex("*language").assign(locale.getLanguage());
r.refOfIndex("*country").assign(locale.getCountry());
r.refOfIndex("*variant").assign(locale.getVariant());
return r.toConstant();
}
代码示例来源:origin: jphp-group/jphp
@Signature
public Memory __debugInfo(Environment env, Memory... args) {
ArrayMemory r = new ArrayMemory();
r.refOfIndex("*name").assign(group.getName());
r.refOfIndex("*maxPriority").assign(group.getMaxPriority());
if (group.getParent() != null)
r.refOfIndex("*parentName").assign(group.getParent().getName());
return r.toConstant();
}
代码示例来源:origin: jphp-group/jphp
@Signature
public Memory __debugInfo() {
ArrayMemory arr = ArrayMemory.createHashed();
arr.refOfIndex("*path").assign(path);
arr.refOfIndex("*methods").assign(ArrayMemory.ofStringCollection(methods));
arr.refOfIndex("*handler").assign(handler.toImmutable());
return arr;
}
代码示例来源:origin: jphp-group/jphp
public static ArrayMemory valueOf(Ref ref) {
ArrayMemory memory = new ArrayMemory();
memory.refOfIndex("name").assign(ref.getName());
memory.refOfIndex("peeled").assign(ref.isPeeled());
memory.refOfIndex("symbolic").assign(ref.isSymbolic());
memory.refOfIndex("objectId").assign(valueOf(ref.getObjectId()));
memory.refOfIndex("storage").assign(valueOf(ref.getStorage()));
return memory;
}
代码示例来源:origin: jphp-group/jphp
public static ArrayMemory valueOf(PersonIdent value) {
ArrayMemory memory = new ArrayMemory();
memory.refOfIndex("name").assign(value.getName());
memory.refOfIndex("email").assign(value.getEmailAddress());
memory.refOfIndex("when").assign(value.getWhen() == null ? Memory.NULL : LongMemory.valueOf(value.getWhen().getTime()));
memory.refOfIndex("timeZone").assign(
value.getTimeZone() == null ? Memory.NULL : StringMemory.valueOf(value.getTimeZone().getID())
);
return memory;
}
代码示例来源:origin: jphp-group/jphp
@Override
public Memory assign(Memory memory) {
switch (getValue().type){
case REFERENCE:
return getValue().assign(memory);
case ARRAY: //value.unset(); // do not need break!!
default:
return setValue(memory);
}
}
代码示例来源:origin: jphp-group/jphp
@Override
public Memory assign(long memory) {
ArrayMemory dup = array.checkCopied();
if (dup != null) return dup.get(key).assign(memory);
return super.assign(memory);
}
代码示例来源:origin: jphp-group/jphp
public static ArrayMemory valueOf(RevObject value) {
ArrayMemory memory = new ArrayMemory();
memory.refOfIndex("id").assign(valueOf(value.getId()));
memory.refOfIndex("type").assign(value.getType());
return memory;
}
代码示例来源:origin: jphp-group/jphp
@Signature
public Memory toArray(Environment env, Memory... args) {
Map<Integer, SourceMap.Item> itemsByLine = getWrappedObject().getItemsByCompiled();
ArrayMemory r = new ArrayMemory();
for (Map.Entry<Integer, SourceMap.Item> entry : itemsByLine.entrySet()) {
r.refOfIndex(entry.getKey()).assign(entry.getValue().sourceLine);
}
return r.toConstant();
}
}
代码示例来源:origin: jphp-group/jphp
public static ArrayMemory valueOf(MergeResult call) {
ArrayMemory memory = new ArrayMemory();
memory.refOfIndex("base").assign(valueOf(call.getBase()));
memory.refOfIndex("newHead").assign(valueOf(call.getNewHead()));
memory.refOfIndex("status").assign(call.getMergeStatus().name());
memory.refOfIndex("success").assign(call.getMergeStatus().isSuccessful());
memory.refOfIndex("checkoutConflicts").assign(ArrayMemory.ofStringCollection(call.getCheckoutConflicts()));
return memory;
}
代码示例来源:origin: jphp-group/jphp
public static ArrayMemory valueOf(PushResult value) {
ArrayMemory memory = valueOf((OperationResult) value);
memory.refOfIndex("remoteUpdates").assign(valueOfRemoteRefUpdates(value.getRemoteUpdates()));
return memory;
}
代码示例来源:origin: jphp-group/jphp
@Signature
public Memory __debugInfo(Environment env, Memory... args) {
ArrayMemory r = new ArrayMemory();
r.refOfIndex("*format").assign(format);
return r.toConstant();
}
代码示例来源:origin: jphp-group/jphp
@Signature
synchronized public Memory __debugInfo(Environment env, Memory... args) {
ArrayMemory info = new ArrayMemory();
info.refOfIndex("*value").assign(value);
return info.toConstant();
}
代码示例来源:origin: jphp-group/jphp
protected static Memory _str_replace_impl(Environment env, TraceInfo trace,
Memory search, Memory replace, Memory string,
@Reference Memory _count, boolean isInsensitive) {
String searchText = search.toString();
String replaceText = replace.toString();
String text = string.toString();
AtomicLong count = _count.isUndefined() ? null : new AtomicLong(_count.toLong());
text = StringUtils.replace(text, searchText, replaceText, isInsensitive, count);
if (count != null) _count.assign(count.get());
return StringMemory.valueOf(text);
}
代码示例来源:origin: jphp-group/jphp
public Memory toObject(Environment env) {
StdClass stdClass = new StdClass(env);
stdClass.getProperties().refOfIndex("scalar").assign(toImmutable());
return new ObjectMemory(stdClass);
}
代码示例来源:origin: jphp-group/jphp
@Override
public Memory assign(String memory) {
switch (getValue().type){
case REFERENCE: return getValue().assign(memory);
case ARRAY: getValue().unset(); // do not need break!!
default:
return setValue(StringMemory.valueOf(memory));
}
}
代码示例来源:origin: jphp-group/jphp
public static Memory array_fill_keys(Environment env, TraceInfo trace, Memory keys, Memory value) {
if (expecting(env, trace, 1, keys, ARRAY)) {
ForeachIterator iterator = keys.getNewIterator(env);
ArrayMemory result = new ArrayMemory();
while (iterator.next()) {
result.refOfIndex(iterator.getValue()).assign(value.toImmutable());
}
return result.toConstant();
} else {
return new ArrayMemory().toConstant();
}
}
代码示例来源:origin: jphp-group/jphp
@Test
public void testWithGlobals(){
ArrayMemory globals = new ArrayMemory();
globals.refOfIndex("y").assign("bar");
Memory memory = includeResource("user_function/with_globals.php", globals);
Assert.assertEquals("foobar", memory.toString());
}
代码示例来源:origin: jphp-group/jphp
@Test
public void testValueOfIndex(){
ArrayMemory memory = new ArrayMemory();
assertEquals(Memory.UNDEFINED, memory.valueOfIndex(0));
assertEquals(0, memory.size());
memory.refOfIndex(new DoubleMemory(2)).assign(2);
assertEquals(2, memory.valueOfIndex(2.0).toLong());
}
内容来源于网络,如有侵权,请联系作者删除!