public class HeapFile.HeapFileIterator extends java.lang.Object implements DbFileIterator
DbFileIterator
,
Serialized FormModifier and Type | Field and Description |
---|---|
(package private) int |
numPages |
(package private) Page |
page |
(package private) int |
pageCounter |
(package private) HeapPageId |
pid |
(package private) int |
tableId |
(package private) TransactionId |
tid |
(package private) java.util.Iterator<Tuple> |
tuples |
Constructor and Description |
---|
HeapFileIterator(TransactionId tid,
int tableId,
int numPages)
Constructor for Iterator
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the iterator
|
private java.util.Iterator<Tuple> |
getTuples(int pageNumber)
Gets tuples from file with given page number
|
boolean |
hasNext()
Checks if iterator has next tuple
|
Tuple |
next()
Get next tuple in this file
|
void |
open()
Opens it iterator for iteration
|
void |
rewind()
Rewinds iterator to the start of file
|
TransactionId tid
int pageCounter
int tableId
int numPages
Page page
java.util.Iterator<Tuple> tuples
HeapPageId pid
public HeapFileIterator(TransactionId tid, int tableId, int numPages)
tid
- TransactionId of requesting transactiontableId
- id of the HeapFilenumPages
- number of pages in fileprivate java.util.Iterator<Tuple> getTuples(int pageNumber) throws DbException, TransactionAbortedException
pageNumber
- DbException
TransactionAbortedException
public void open() throws DbException, TransactionAbortedException
open
in interface DbFileIterator
DbException
TransactionAbortedException
public boolean hasNext() throws DbException, TransactionAbortedException
hasNext
in interface DbFileIterator
DbException
TransactionAbortedException
public Tuple next() throws DbException, TransactionAbortedException, java.util.NoSuchElementException
next
in interface DbFileIterator
DbException
TransactionAbortedException
java.util.NoSuchElementException
public void rewind() throws DbException, TransactionAbortedException
rewind
in interface DbFileIterator
DbException
TransactionAbortedException
public void close()
close
in interface DbFileIterator