Beispiel #1
0
  /**
   * Sets the values in the given positions to the values from the given Tuple.
   *
   * @param pos of type int[]
   * @param tuple of type Tuple
   */
  void set(int[] pos, Tuple tuple) {
    verifyModifiable();

    if (pos.length != tuple.size())
      throw new TupleException(
          "given tuple not same size as position array, tuple: " + tuple.print());

    int count = 0;
    for (int i : pos) elements.set(i, tuple.elements.get(count++));
  }
Beispiel #2
0
  private StringBuffer print(StringBuffer buffer) {
    buffer.append("[");
    for (int i = 0; i < elements.size(); i++) {
      Comparable element = elements.get(i);

      if (element instanceof Tuple) ((Tuple) element).print(buffer);
      else buffer.append("\'").append(element).append("\'");

      if (i < elements.size() - 1) buffer.append(", ");
    }
    buffer.append("]");

    return buffer;
  }