本文整理了Java中php.runtime.Memory.isTraversable()
方法的一些代码示例,展示了Memory.isTraversable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Memory.isTraversable()
方法的具体详情如下:
包路径:php.runtime.Memory
类名称:Memory
方法名:isTraversable
暂无
代码示例来源:origin: jphp-group/jphp
public static boolean is_iterable(@Reference Memory memory) {
return memory.isTraversable();
}
代码示例来源:origin: jphp-group/jphp
@Signature
public static boolean hasExt(Environment env, String path, Memory extensions, boolean ignoreCase) {
Set<String> exts = new HashSet<>();
if (extensions.isTraversable()) {
ForeachIterator iterator = extensions.getNewIterator(env);
while (iterator.next()) {
String value = iterator.getValue().toString();
if (ignoreCase) {
value = value.toLowerCase();
}
exts.add(value);
}
} else {
exts.add(ignoreCase ? extensions.toString().toLowerCase() : extensions.toString());
}
String ext = ext(path);
if (ignoreCase && ext != null) {
ext = ext.toLowerCase();
}
return exts.contains(ext);
}
代码示例来源:origin: jphp-group/jphp
if (methods.isTraversable()) {
ForeachIterator iterator = methods.getNewIterator(env);
while (iterator.next()) {
代码示例来源:origin: jphp-group/jphp
@Signature
public void remove(Environment env, Memory path) {
if (path.isTraversable()) {
ForeachIterator iterator = path.getNewIterator(env);
List<String> paths = new ArrayList<>();
while (iterator.next()) {
String value = iterator.getValue().toString();
paths.add(value);
}
ZipUtil.removeEntries(zipFile, paths.toArray(new String[paths.size()]));
} else {
ZipUtil.removeEntry(zipFile, path.toString());
}
}
代码示例来源:origin: jphp-group/jphp
if (foreachIterator == null || (!isGenerator && !arg.isTraversable())) {
env.warning(trace, INVALID_TYPE_MESSAGE);
} else {
代码示例来源:origin: jphp-group/jphp
@Override
public BasicDBObject convert(Environment env, TraceInfo trace, Memory arg) throws Throwable {
if (arg.isNull()) return null;
ForeachIterator iterator = arg.getNewIterator(env);
BasicDBObject dbObject = new BasicDBObject();
while (iterator.next()) {
if (iterator.getValue().isTraversable()) {
dbObject.append(iterator.getStringKey(), convert(env, trace, iterator.getValue()));
} else {
dbObject.append(iterator.getStringKey(), Memory.unwrap(env, iterator.getValue()));
}
}
return dbObject;
}
代码示例来源:origin: jphp-group/jphp
@Override
public Document convert(Environment env, TraceInfo trace, Memory arg) throws Throwable {
if (arg.isNull()) return null;
ForeachIterator iterator = arg.getNewIterator(env);
Document dbObject = new Document();
while (iterator.next()) {
if (iterator.getValue().isTraversable()) {
dbObject.append(iterator.getStringKey(), convert(env, trace, iterator.getValue()));
} else {
dbObject.append(iterator.getStringKey(), Memory.unwrap(env, iterator.getValue()));
}
}
return dbObject;
}
代码示例来源:origin: jphp-group/jphp
public static Memory flow(Environment env, Memory... others) {
WrapFlow flow = WrapFlow.of(env, new ArrayMemory()).toObject(WrapFlow.class);
if (others != null) {
for (Memory other : others) {
if (other.isTraversable()) {
flow = flow.append(env, other).toObject(WrapFlow.class);
} else {
flow = flow.append(env, ArrayMemory.of(other)).toObject(WrapFlow.class);
}
}
}
return ObjectMemory.valueOf(flow);
}
代码示例来源:origin: jphp-group/jphp
@Signature(@Arg("collection"))
public static Memory toList(Environment env, Memory... args) {
ArrayMemory r = new ArrayMemory();
for(Memory arg : args) {
if (arg.isTraversable()) {
ForeachIterator iterator = arg.getNewIterator(env);
while (iterator.next())
r.add(iterator.getValue().toImmutable());
} else
r.add(arg.toImmutable());
}
return r.toConstant();
}
代码示例来源:origin: jphp-group/jphp
@Signature
public Memory findAll(Invoker filter) {
ArrayMemory result = new ArrayMemory();
for (SourceFile sourceFile : sourceFileMap.values()) {
Memory memory = filter.callAny(sourceFile.getModuleRecord());
if (!memory.isNull()) {
if (memory.isTraversable()) {
ForeachIterator iterator = memory.getNewIterator(env);
while (iterator.next()) {
result.add(iterator.getValue().toImmutable());
}
} else {
result.add(memory);
}
}
}
return result.toConstant();
}
代码示例来源:origin: jphp-group/jphp
return value.isArray();
case TRAVERSABLE:
return value.isTraversable();
case ITERABLE:
return value.isTraversable();
case CALLABLE:
Invoker invoker = Invoker.valueOf(env, null, value);
代码示例来源:origin: jphp-group/jphp
if (paths.isTraversable()) {
ForeachIterator iterator = paths.getNewIterator(env);
while (iterator.next()) {
内容来源于网络,如有侵权,请联系作者删除!