Esempio n. 1
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 fetchNext()
     throws NoSuchElementException, TransactionAbortedException, DbException {
   try {
     Tuple cur_tuple = m_child.next();
     while (true) {
       if (m_predicate.filter(cur_tuple)) {
         return cur_tuple;
       }
       cur_tuple = m_child.next();
     }
   } catch (NoSuchElementException e) {
     return null;
   }
 }
Esempio n. 2
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;
  }
Esempio n. 3
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;
 }