本文整理了Java中php.runtime.Memory.getPointer()
方法的一些代码示例,展示了Memory.getPointer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Memory.getPointer()
方法的具体详情如下:
包路径:php.runtime.Memory
类名称:Memory
方法名:getPointer
暂无
代码示例来源:origin: jphp-group/jphp
@Override
public int getPointer() {
return getValue().getPointer();
}
代码示例来源:origin: jphp-group/jphp
public static Memory spl_object_hash(Environment env, TraceInfo trace, Memory object){
if (expecting(env, trace, 1, object, Memory.Type.OBJECT)){
return LongMemory.valueOf(object.getPointer());
} else
return Memory.FALSE;
}
代码示例来源:origin: jphp-group/jphp
@Override
public int getPointer(boolean absolute) {
return absolute ? getValue().getPointer() : getPointer();
}
代码示例来源:origin: jphp-group/jphp
protected static void flatten(Environment env, ForeachIterator iterator, Set<Integer> used, ArrayMemory array,
int level, int maxLevel) {
while (iterator.next()) {
Memory el = iterator.getValue();
ForeachIterator innerIterator = el.getNewIterator(env);
if (innerIterator == null || (level >= maxLevel && maxLevel > -1)) {
array.add(el.toImmutable());
} else {
if (used.add(el.getPointer())) {
flatten(env, innerIterator, used, array, level + 1, maxLevel);
used.remove(el.getPointer());
}
}
}
}
代码示例来源:origin: jphp-group/jphp
if (used.add(value.getPointer())) {
processArray(property, value.toValue(ArrayMemory.class), used, false);
used.remove(value.getPointer());
} else {
property.appendChild(document.createCDATASection(Base64.encodeBase64String("**RECURSION**".getBytes())));
if (used.add(value.getPointer())) {
processObject(property, value.toValue(ObjectMemory.class), used);
used.remove(value.getPointer());
} else {
property.appendChild(document.createCDATASection(Base64.encodeBase64String("**RECURSION**".getBytes())));
代码示例来源:origin: jphp-group/jphp
private static Memory _array_merge(Environment env, TraceInfo trace, boolean recursive, Memory array, Memory... arrays) {
if (!array.isArray()) {
env.warning(trace, "Argument %s is not an array", 1);
return Memory.NULL;
}
if (arrays == null || arrays.length == 0)
return array;
ArrayMemory result = (ArrayMemory) array.toImmutable();
int i = 2;
Set<Integer> used = recursive ? new HashSet<Integer>() : null;
for (Memory el : arrays) {
if (!el.isArray()) {
env.warning(trace, "Argument %s is not an array", i);
continue;
}
if (used != null)
used.add(el.getPointer(true));
result.merge((ArrayMemory) el, recursive, used);
if (used != null)
used.remove(el.getPointer(true));
i++;
}
return result;
}
代码示例来源:origin: jphp-group/jphp
public static boolean array_walk_recursive(Environment env, TraceInfo trace, @Reference Memory input,
Memory callback, Memory userData)
throws Throwable {
if (!expectingReference(env, trace, input, "array_walk_recursive"))
return false;
if (!expecting(env, trace, 1, input, ARRAY))
return false;
Invoker invoker = expectingCallback(env, trace, 2, callback);
if (invoker == null)
return false;
Set<Integer> used = new HashSet<Integer>();
used.add(input.getPointer());
return _array_walk_recursive(env, trace, input, invoker, userData, used);
}
代码示例来源:origin: jphp-group/jphp
public static boolean _array_walk_recursive(Environment env, TraceInfo trace,
Memory input,
Invoker invoker, Memory userData, Set<Integer> used)
throws Throwable {
if (used == null)
used = new HashSet<Integer>();
ForeachIterator iterator = input.getNewIterator(env, true, false);
while (iterator.next()) {
Memory item = iterator.getValue();
if (item.isArray()) {
if (used.add(item.getPointer())) {
boolean result = _array_walk_recursive(env, trace, item, invoker, userData, used);
used.remove(item.getPointer());
if (!result)
return false;
} else {
env.warning(trace, "array_walk_recursive(): recursion detected");
}
} else {
Memory key = iterator.getMemoryKey();
invoker.call(item, key, userData);
}
}
return true;
}
代码示例来源:origin: jphp-group/jphp
private static int recursive_count(Environment env, TraceInfo trace, ArrayMemory array, Set<Integer> used){
ForeachIterator iterator = array.foreachIterator(false, false);
int size = array.size();
while (iterator.next()){
Memory el = iterator.getValue();
if (el.isArray()){
if (used == null)
used = new HashSet<>();
int pointer = el.getPointer();
if (!used.add(pointer)){
env.warning(trace, "recursion detected");
} else {
size += recursive_count(env, trace, array, used);
}
used.remove(pointer);
}
}
return size;
}
代码示例来源:origin: jphp-group/jphp
@Signature({
@Arg(value = "collection", type = HintType.TRAVERSABLE),
@Arg(value = "level", optional = @Optional("-1"))
})
public static Memory flatten(Environment env, Memory... args) {
ArrayMemory r = new ArrayMemory();
int level = args[1].toInteger();
ForeachIterator iterator = args[0].getNewIterator(env);
if (iterator == null) {
return Memory.NULL;
}
Set<Integer> used = new HashSet<Integer>();
used.add(args[0].getPointer());
flatten(env, iterator, used, r, 0, level);
return r.toConstant();
}
代码示例来源:origin: jphp-group/jphp
if (!used.contains(el.getPointer()))
printer.write("\n");
else
代码示例来源:origin: jphp-group/jphp
if (used.add(src.getPointer())){
JsonArray array = new JsonArray();
JsonObject object = new JsonObject();
object.add(iterator.getKey().toString(), convert(iterator.getValue(), used, useHandlers));
used.remove(src.getPointer());
return isList ? array : object;
} else
if (used.add(src.getPointer())) {
IObject object = src.toValue(ObjectMemory.class).value;
代码示例来源:origin: jphp-group/jphp
Memory value = entry.getValue();
if (recursive && value.isArray()) {
if (done.contains(value.getPointer()))
throw new RecursiveException();
value = value.toImmutable();
int pointer = value.getPointer();
代码示例来源:origin: jphp-group/jphp
if (used.add(value2.getPointer())) {
int r = arr1.compare(value2.toValue(ArrayMemory.class), strict, used);
if (r == 0) {
used.remove(value2.getPointer());
continue;
used.remove(value2.getPointer());
} else if (value1.isObject() && value2.isObject()) {
ObjectMemory o1 = value1.toValue(ObjectMemory.class);
内容来源于网络,如有侵权,请联系作者删除!