Example #1
0
 protected void set(Fields declarator, Fields selector, Tuple tuple, CoercibleType[] coercions) {
   try {
     set(declarator.getPos(selector), declarator.getTypes(), tuple, coercions);
   } catch (Exception exception) {
     throw new TupleException(
         "unable to set into: " + declarator.print() + ", using selector: " + selector.print(),
         exception);
   }
 }
Example #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) {
   try {
     return get(getPos(declarator, selector));
   } catch (Exception exception) {
     throw new TupleException(
         "unable to select from: " + declarator.print() + ", using selector: " + selector.print(),
         exception);
   }
 }
Example #3
0
 /**
  * Method set sets the values in the given selector positions to the values from the given Tuple.
  *
  * <p>If type information is given, each incoming value from tuple will be coerced from its
  * canonical type to the current type as declared in the declarator.
  *
  * @param declarator of type Fields
  * @param selector of type Fields
  * @param tuple of type Tuple
  */
 public void set(Fields declarator, Fields selector, Tuple tuple) {
   try {
     set(
         declarator.getPos(selector),
         declarator.getTypes(),
         tuple,
         TupleEntry.getCoercions(declarator, tuple));
   } catch (Exception exception) {
     throw new TupleException(
         "unable to set into: " + declarator.print() + ", using selector: " + selector.print(),
         exception);
   }
 }
Example #4
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()));
  }