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

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

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

Memory.plus介绍

暂无

代码示例

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

@Override
  public Memory calc(Environment env, TraceInfo trace, Memory o1, Memory o2) {
    return o1.plus(o2);
  }
}

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

public static Memory plus(boolean o1, Memory value) {
  return o1 ? Memory.TRUE.plus(value) : Memory.FALSE.plus(value);
}

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

@Override
public Memory plus(Memory memory) {
  return getValue().plus(memory);
}

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

@Override
public Memory plus(Memory memory) {
  return toNumeric().plus(memory);
}

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

@Override
public Memory plus(Memory memory) {
  return toNumeric().plus(memory);
}

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

@Override
public Memory plus(boolean value) {
  return this.getValue().plus(value);
}

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

@Override
public Memory plus(String value) {
  return this.getValue().plus(value);
}

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

@Override
public Memory plus(long value) {
  return this.getValue().plus(value);
}

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

@Override
public Memory plus(double value) {
  return this.getValue().plus(value);
}

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

public Memory assignPlus(String memory) { return assign(plus(memory)); }
public Memory assignPlusRight(Memory memory) { return memory.assign(memory.plus(this)); }

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

public Memory assignPlus(boolean memory) { return assign(plus(memory)); }
public Memory assignPlus(String memory) { return assign(plus(memory)); }

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

public Memory assignPlus(Memory memory) { return assign(plus(memory)); }
public Memory assignPlus(long memory) { return assign(plus(memory)); }

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

public Memory assignPlus(long memory) { return assign(plus(memory)); }
public Memory assignPlus(double memory) { return assign(plus(memory)); }

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

public Memory assignPlus(double memory) { return assign(plus(memory)); }
public Memory assignPlus(boolean memory) { return assign(plus(memory)); }

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

public Memory plus(String value){ return plus(StringMemory.toNumeric(value)); }

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

@Override
  public Memory invoke(Memory o1, Memory o2) {
    if (oldValue != null)
      oldValue.assign(o1.toValue());
    return o1.plus(o2);
  }
}, null, 0);

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

@Signature(@Arg(value = "comparator", type = HintType.CALLABLE, optional = @Optional("null")))
public Memory numMedian(Environment env, Memory... args) {
  List<Memory> list = sort(env, args[0])
      .toValue(ArrayMemory.class)
      .stream().collect(Collectors.toList());
  if (list.isEmpty()) return Memory.NULL;
  if (list.size() % 2 == 0) {
    return list.get(list.size() / 2).plus(list.get(list.size() / 2 + 1)).div(Memory.CONST_INT_2).toNumeric();
  } else {
    return list.get(list.size() / 2).toNumeric();
  }
}

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

@Signature
public Memory avg(Environment env, Memory... args) {
  Memory result = Memory.CONST_INT_0;
  int cnt = 0;
  for (Memory memory : getSelfIterator(env)) {
    result = result.plus(memory);
    cnt++;
  }
  return result.div(LongMemory.valueOf(cnt));
}

代码示例来源: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

@Override
public Memory plus(Memory memory) {
  switch (memory.type){
    case INT: return LongMemory.valueOf(1 + ((LongMemory) memory).value);
    case DOUBLE: return new DoubleMemory(1 + ((DoubleMemory)memory).value);
    case REFERENCE: return plus(memory.toValue());
    default: return memory.toNumeric().plus(CONST_INT_1);
  }
}

相关文章