Пример #1
0
  /**
   * Method put places the values of the given tuple into the positions specified by the fields
   * argument. The declarator Fields value declares the fields in this Tuple instance.
   *
   * @param declarator of type Fields
   * @param fields of type Fields
   * @param tuple of type Tuple
   */
  public void put(Fields declarator, Fields fields, Tuple tuple) {
    verifyModifiable();

    int[] pos = declarator.getPos(fields, size());

    for (int i = 0; i < pos.length; i++) elements.set(pos[i], tuple.get(i));
  }
Пример #2
0
  /**
   * Method get returns a new Tuple populated with only those values whose field names are specified
   * in the given selector. The declarator Fields instance declares the fields and positions in the
   * current Tuple instance.
   *
   * @param declarator of type Fields
   * @param selector of type Fields
   * @return Tuple
   */
  public Tuple get(Fields declarator, Fields selector) {
    if (!declarator.isUnknown() && elements.size() != declarator.size())
      throw new TupleException(
          "field declaration: " + declarator.print() + ", does not match tuple: " + print());

    return get(declarator.getPos(selector, size()));
  }
Пример #3
0
 /**
  * Method set sets the values in the given selector positions to the values from the given Tuple.
  *
  * @param declarator of type Fields
  * @param selector of type Fields
  * @param tuple of type Tuple
  */
 public void set(Fields declarator, Fields selector, Tuple tuple) {
   set(declarator.getPos(selector), tuple);
 }
Пример #4
0
 /**
  * Method remove removes the values specified by the given selector. The declarator declares the
  * fields in this instance.
  *
  * @param declarator of type Fields
  * @param selector of type Fields
  * @return Tuple
  */
 public Tuple remove(Fields declarator, Fields selector) {
   return remove(declarator.getPos(selector, size()));
 }