Esempio n. 1
0
 public ValuesArray invert(Combine com) {
   final int size = size();
   final ValuesArray res = new ValuesArray(this);
   for (int i = 0; i < size; i++) {
     res.set(i, com.negate(get(i)));
   }
   return res;
 }
Esempio n. 2
0
  public ValuesArray combine(ValuesArray other, Combine com) {
    final int size = size();

    if (size != other.size()) {
      throw new ArrayIndexOutOfBoundsException(
          "Value arrays must be of the same size to be combined.\n" + this + "\n" + other);
    }

    ValuesArray res = new ValuesArray(this);
    for (int i = 0; i < size; i++) {
      res.set(i, com.eval(get(i), other.get(i)));
    }

    return res;
  }