Example #1
0
  /**
   * Operator.readNext implementation. Iterates over tuples from the child operator, applying the
   * predicate to them and returning those that pass the predicate (i.e. for which the
   * Predicate.filter() returns true.)
   *
   * @return The next tuple that passes the filter, or null if there are no more tuples
   * @see Predicate#filter
   */
  protected Tuple fetchNext()
      throws NoSuchElementException, TransactionAbortedException, DbException {
    // some code goes here
    // DONE?
    while (_child.hasNext()) {
      Tuple t = _child.next();
      if (_p.filter(t)) return t;
    }

    return null;
  }
Example #2
0
 /**
  * AbstractDbIterator.readNext implementation. Iterates over tuples from the child operator,
  * applying the predicate to them and returning those that pass the predicate (i.e. for which the
  * Predicate.filter() returns true.)
  *
  * @return The next tuple that passes the filter, or null if there are no more tuples
  * @see Predicate#filter
  */
 protected Tuple readNext()
     throws NoSuchElementException, TransactionAbortedException, DbException {
   Tuple t;
   for (; ; ) {
     t = null;
     if (!child.hasNext()) {
       break;
     } else {
       t = child.next();
       if (p.filter(t)) {
         System.out.println();
         break;
       }
     }
   }
   return t;
 }