MCPcopy Create free account
hub / github.com/1345414527/MIT6.830 / TupleArrayIterator

Class TupleArrayIterator

src/java/simpledb/Parser.java:691–745  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

689}
690
691class TupleArrayIterator implements OpIterator {
692 /**
693 *
694 */
695 private static final long serialVersionUID = 1L;
696 final List<Tuple> tups;
697 Iterator<Tuple> it = null;
698
699 public TupleArrayIterator(List<Tuple> tups) {
700 this.tups = tups;
701 }
702
703 public void open() {
704 it = tups.iterator();
705 }
706
707 /** @return true if the iterator has more items. */
708 public boolean hasNext() {
709 return it.hasNext();
710 }
711
712 /**
713 * Gets the next tuple from the operator (typically implementing by reading
714 * from a child operator or an access method).
715 *
716 * @return The next tuple in the iterator, or null if there are no more
717 * tuples.
718 */
719 public Tuple next() throws
720 NoSuchElementException {
721 return it.next();
722 }
723
724 /**
725 * Resets the iterator to the start.
726 *
727 */
728 public void rewind() {
729 it = tups.iterator();
730 }
731
732 /**
733 * Returns the TupleDesc associated with this OpIterator.
734 */
735 public TupleDesc getTupleDesc() {
736 return tups.get(0).getTupleDesc();
737 }
738
739 /**
740 * Closes the iterator.
741 */
742 public void close() {
743 }
744
745}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected