public abstract class Operator extends java.lang.Object implements DbIterator
close
,
next
and hasNext
. Subclasses only need to implement
open
and readNext
.Modifier and Type | Field and Description |
---|---|
private int |
estimatedCardinality |
private Tuple |
next |
private boolean |
open |
private static long |
serialVersionUID |
Constructor and Description |
---|
Operator() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this iterator.
|
protected abstract Tuple |
fetchNext()
Returns the next Tuple in the iterator, or null if the iteration is
finished.
|
abstract DbIterator[] |
getChildren() |
int |
getEstimatedCardinality() |
abstract TupleDesc |
getTupleDesc()
Returns the TupleDesc associated with this DbIterator.
|
boolean |
hasNext()
Returns true if the iterator has more tuples.
|
Tuple |
next()
Returns the next tuple from the operator (typically implementing by reading
from a child operator or an access method).
|
void |
open()
Opens the iterator.
|
abstract void |
setChildren(DbIterator[] children)
Set the children(child) of this operator.
|
protected void |
setEstimatedCardinality(int card) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
rewind
private static final long serialVersionUID
private Tuple next
private boolean open
private int estimatedCardinality
public boolean hasNext() throws DbException, TransactionAbortedException
DbIterator
hasNext
in interface DbIterator
DbException
TransactionAbortedException
public Tuple next() throws DbException, TransactionAbortedException, java.util.NoSuchElementException
DbIterator
next
in interface DbIterator
java.util.NoSuchElementException
- if there are no more tuples.DbException
TransactionAbortedException
protected abstract Tuple fetchNext() throws DbException, TransactionAbortedException
next
and hasNext
.DbException
TransactionAbortedException
public void close()
close
in interface DbIterator
public void open() throws DbException, TransactionAbortedException
DbIterator
open
in interface DbIterator
DbException
- when there are problems opening/accessing the database.TransactionAbortedException
public abstract DbIterator[] getChildren()
public abstract void setChildren(DbIterator[] children)
children
- the DbIterators which are to be set as the children(child) of
this operatorpublic abstract TupleDesc getTupleDesc()
DbIterator
getTupleDesc
in interface DbIterator
public int getEstimatedCardinality()
protected void setEstimatedCardinality(int card)
card
- The estimated cardinality of this operator.