simpledb
Class TupleIterator
java.lang.Object
simpledb.TupleIterator
- All Implemented Interfaces:
- DbIterator
public class TupleIterator
- extends java.lang.Object
- implements DbIterator
Implements a DbIterator by wrapping an Iterable.
Field Summary |
(package private) java.util.Iterator<Tuple> |
i
|
(package private) TupleDesc |
td
|
(package private) java.lang.Iterable<Tuple> |
tuples
|
Constructor Summary |
TupleIterator(TupleDesc td,
java.lang.Iterable<Tuple> tuples)
Constructs an iterator from the specified Iterable, and the specified descriptor. |
Method Summary |
void |
close()
Closes the iterator. |
TupleDesc |
getTupleDesc()
Returns the TupleDesc associated with this DbIterator. |
boolean |
hasNext()
|
Tuple |
next()
Gets the next tuple from the operator (typically implementing by reading
from a child operator or an access method). |
void |
open()
Opens the iterator. |
void |
rewind()
Resets the iterator to the start. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
i
java.util.Iterator<Tuple> i
td
TupleDesc td
tuples
java.lang.Iterable<Tuple> tuples
TupleIterator
public TupleIterator(TupleDesc td,
java.lang.Iterable<Tuple> tuples)
- Constructs an iterator from the specified Iterable, and the specified descriptor.
- Parameters:
tuples
- The set of tuples to iterate over
open
public void open()
- Description copied from interface:
DbIterator
- Opens the iterator.
- Specified by:
open
in interface DbIterator
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface DbIterator
- Returns:
- true if the iterator has more items.
next
public Tuple next()
- Description copied from interface:
DbIterator
- Gets the next tuple from the operator (typically implementing by reading
from a child operator or an access method).
- Specified by:
next
in interface DbIterator
- Returns:
- The next tuple in the iterator, or null if there are no more tuples.
rewind
public void rewind()
- Description copied from interface:
DbIterator
- Resets the iterator to the start.
- Specified by:
rewind
in interface DbIterator
getTupleDesc
public TupleDesc getTupleDesc()
- Description copied from interface:
DbIterator
- Returns the TupleDesc associated with this DbIterator.
- Specified by:
getTupleDesc
in interface DbIterator
close
public void close()
- Description copied from interface:
DbIterator
- Closes the iterator.
- Specified by:
close
in interface DbIterator