php.runtime.Memory.wrap()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中php.runtime.Memory.wrap()方法的一些代码示例,展示了Memory.wrap()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Memory.wrap()方法的具体详情如下:
包路径:php.runtime.Memory
类名称:Memory
方法名:wrap

Memory.wrap介绍

暂无

代码示例

代码示例来源:origin: jphp-group/jphp

@Override
  public Memory unconvert(Environment env, TraceInfo trace, Object arg) throws Throwable {
    return Memory.wrap(env, arg);
  }
}

代码示例来源:origin: jphp-group/jphp

public CompileConstant(String name, Object value){
  this(name, Memory.wrap(null, value));
}

代码示例来源:origin: jphp-group/jphp

@Override
protected boolean nextValue() {
  if (entries.hasNext()) {
    Map.Entry<Object, Object> entry = entries.next();
    currentKey = entry.getKey();
    currentKeyMemory = currentKey == null ? Memory.NULL : StringMemory.valueOf(currentKey.toString());
    currentValue = Memory.wrap(env, entry.getValue());
    if (!getReferences) {
      currentValue = currentValue.toValue();
    }
    return true;
  }
  return false;
}

代码示例来源:origin: jphp-group/jphp

@Override
protected boolean nextValue() {
  if (!iterator.hasNext()) {
    return false;
  }
  Object next = iterator.next();
  currentKeyMemory = currentKeyMemory == null ? Memory.CONST_INT_0 : currentKeyMemory.inc();
  currentKey = currentKeyMemory.toLong();
  currentValue = Memory.wrap(env, next);
  return true;
}

代码示例来源:origin: jphp-group/jphp

@Override
public Memory unconvert(Environment env, TraceInfo trace, Map arg) throws Throwable {
  if (arg == null) {
    return Memory.NULL;
  }
  ArrayMemory result = new ArrayMemory();
  for (Object _entry : arg.entrySet()) {
    Map.Entry entry = (Map.Entry) _entry;
    Memory key = operations.length > 0
        ? operations[0].unconvert(env, trace, entry.getKey())
        : Memory.wrap(env, entry.getKey());
    Memory value = operations.length > 1
        ? operations[1].unconvert(env, trace, entry.getValue())
        : Memory.wrap(env, entry.getValue());
    result.refOfIndex(key).assign(value);
  }
  return result.toConstant();
}

代码示例来源:origin: jphp-group/jphp

@Override
public Memory unconvert(Environment env, TraceInfo trace, Document arg) throws Throwable {
  if (arg == null) return Memory.NULL;
  ArrayMemory result = ArrayMemory.createHashed(arg.size());
  for (Entry<String, Object> entry : arg.entrySet()) {
    if (entry.getValue() instanceof Document) {
      result.put(entry.getKey(), unconvert(env, trace, (Document) entry.getValue()));
    } else {
      result.put(entry.getKey(), Memory.wrap(env, entry.getValue()));
    }
  }
  return result;
}

代码示例来源:origin: jphp-group/jphp

@Override
public Memory unconvert(Environment env, TraceInfo trace, BasicDBObject arg) throws Throwable {
  if (arg == null) return Memory.NULL;
  ArrayMemory result = ArrayMemory.createHashed(arg.size());
  for (Entry<String, Object> entry : arg.entrySet()) {
    if (entry.getValue() instanceof BasicDBObject) {
      result.put(entry.getKey(), unconvert(env, trace, (BasicDBObject) entry.getValue()));
    } else {
      result.put(entry.getKey(), Memory.wrap(env, entry.getValue()));
    }
  }
  return null;
}

代码示例来源:origin: jphp-group/jphp

@Override
@Signature
public Memory parse(Environment env, Memory... args) {
  try {
    if (args[0].instanceOf(Stream.class)) {
      return Memory.wrap(env, yaml.load(Stream.getInputStream(env, args[0])));
    } else {
      return Memory.wrap(env, yaml.load(args[0].toString()));
    }
  } catch (YAMLException e) {
    env.exception(ProcessorException.class, e.getMessage());
    return Memory.NULL;
  }
}

代码示例来源:origin: jphp-group/jphp

@Override
protected boolean nextValue() {
  if (iterator.hasNext()) {
    Document document = iterator.tryNext();
    if (document == null) {
      return false;
    }
    this.currentValue = Memory.wrap(env, document);
    this.currentKeyMemory = counter;
    this.currentKey = counter;
    counter = counter.inc();
    return true;
  } else {
    return false;
  }
}

代码示例来源:origin: jphp-group/jphp

@Override
@SuppressWarnings("unchecked")
public Memory unconvert(Environment env, TraceInfo trace, Collection arg) throws Throwable {
  if (arg == null) {
    return Memory.NULL;
  }
  ArrayMemory result = new ArrayMemory();
  for (Object el : arg) {
    if (operations.length >= 1) {
      result.add(operations[0].unconvert(env, trace, el));
    } else {
      result.add(Memory.wrap(env, el));
    }
  }
  return result.toConstant();
}

相关文章