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

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

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

Memory.getNewIterator介绍

暂无

代码示例

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

@Override
  public ForeachIterator getNewIterator(Environment env) {
    return ObjectMemory.valueOf(this).getNewIterator(env);
  }
}

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

@Override
  public ForeachIterator getNewIterator(Environment env) {
    return ObjectMemory.valueOf(this).getNewIterator(env);
  }
}

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

@Override
  public ForeachIterator getNewIterator(Environment env) {
    return ObjectMemory.valueOf(this).getNewIterator(env);
  }
}

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

@Override
  public ForeachIterator getNewIterator(Environment env) {
    return ObjectMemory.valueOf(this).getNewIterator(env);
  }
}

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

@Override
  public ForeachIterator getNewIterator(Environment env) {
    return ObjectMemory.valueOf(this).getNewIterator(env);
  }
}

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

@Override
@SuppressWarnings("unchecked")
public Enumeration convert(Environment env, TraceInfo trace, Memory arg) throws Throwable {
  Vector result = new Vector();
  for (Memory el : arg.getNewIterator(env)) {
    result.add(operations[0].convert(env, trace, el));
  }
  return result.elements();
}

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

@Override
  public ForeachIterator getNewIterator(Environment env) {
    return ObjectMemory.valueOf(this).getNewIterator(env);
  }
}

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

@Override
  public ForeachIterator getNewIterator(Environment env) {
    return ObjectMemory.valueOf(this).getNewIterator(env);
  }
}

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

@Override
public ForeachIterator getNewIterator(Environment env, boolean getReferences, boolean getKeyReferences) {
  return ObjectMemory.valueOf(this).getNewIterator(env, getReferences, getKeyReferences);
}

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

@Override
public ForeachIterator getNewIterator(Environment env, boolean getReferences, boolean getKeyReferences) {
  return ObjectMemory.valueOf(this).getNewIterator(env, getReferences, getKeyReferences);
}

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

@Signature(@Arg(value = "iterator", type = HintType.TRAVERSABLE))
public Memory __construct(Environment env, Memory... args) {
  iterator = args[0].toImmutable();
  foreachIterator = iterator.getNewIterator(env);
  return iterator;
}

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

public ForeachIterator __getIterator(TraceInfo trace, Memory memory, boolean getReferences, boolean getKeyReferences) {
  ForeachIterator iterator = memory.getNewIterator(this, getReferences, getKeyReferences);
  if (iterator == null) {
    warning(trace, "Invalid argument supplied for foreach()");
    return invalidIterator;
  }
  iterator.setTrace(trace);
  return iterator;
}

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

@Signature({
    @Arg(value = "collection", type = HintType.TRAVERSABLE)
})
public static Memory firstKey(Environment env, Memory... args) {
  ForeachIterator iterator = args[0].getNewIterator(env);
  if (iterator.next()) {
    return iterator.getMemoryKey();
  }
  return Memory.NULL;
}

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

@Signature({
    @Arg(value = "collection", type = HintType.TRAVERSABLE)
})
public static Memory first(Environment env, Memory... args) {
  ForeachIterator iterator = args[0].getNewIterator(env);
  if (iterator.next()) {
    return iterator.getValue();
  }
  return Memory.NULL;
}

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

public static Memory array_product(Environment env, TraceInfo trace, Memory input) {
  if (expecting(env, trace, 1, input, ARRAY)) {
    ForeachIterator iterator = input.getNewIterator(env, false, false);
    Memory result = Memory.CONST_INT_1;
    while (iterator.next()) {
      result = result.mul(iterator.getValue());
    }
    return result;
  } else
    return Memory.NULL;
}

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

public static Memory array_sum(Environment env, TraceInfo trace, Memory input) {
  if (expecting(env, trace, 1, input, ARRAY)) {
    ForeachIterator iterator = input.getNewIterator(env, false, false);
    Memory result = Memory.CONST_INT_0;
    while (iterator.next()) {
      result = result.plus(iterator.getValue());
    }
    return result;
  } else
    return Memory.NULL;
}

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

@FastMethod
@Signature({
    @Arg(value = "collection", type = HintType.TRAVERSABLE)
})
public static Memory of(Environment env, Memory... args) {
  return new ObjectMemory(new WrapFlow(env, args[0].toImmutable().getNewIterator(env)));
}

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

@Signature({
      @Arg(value = "collection", type = HintType.ARRAY)
  })
  public static Memory reverse(Environment env, Memory... args) {
    ForeachIterator iterator = args[0].getNewIterator(env);

    ArrayMemory result = new ArrayMemory();

    while (iterator.next()) {
      result.unshift(iterator.getValue().toImmutable());
    }

    return result.toConstant();
  }
}

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

public static Memory array_flip(Environment env, TraceInfo trace, Memory input) {
  if (!expecting(env, trace, 1, input, ARRAY))
    return Memory.NULL;
  ArrayMemory result = new ArrayMemory();
  ForeachIterator iterator = input.getNewIterator(env, false, false);
  while (iterator.next())
    result.put(ArrayMemory.toKey(iterator.getValue()), iterator.getMemoryKey());
  return result.toConstant();
}

代码示例来源: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();
  }
}

相关文章