Commit partial work

This commit is contained in:
Max O'Cull 2019-03-28 02:06:17 -04:00
parent c076533a19
commit 732977b4fa
3 changed files with 28 additions and 12 deletions

BIN
p3/max.minibase Normal file

Binary file not shown.

View File

@ -9,7 +9,6 @@ import heap.HeapScan;
* version takes schema into consideration and generates real tuples.
*/
public class FileScan extends Iterator {
private HeapFile file = null; // needed for restart(), getFile();
private HeapScan scan = null;
private RID rid = null;

View File

@ -9,12 +9,22 @@ import index.HashScan;
* Wrapper for hash scan, an index access method.
*/
public class KeyScan extends Iterator {
private HeapFile file = null; // needed for restart(), getFile();
private HashScan scan = null;
private HashIndex index = null;
private SearchKey key = null;
private boolean isOpen;
/**
* Constructs an index scan, given the hash index and schema.
*/
public KeyScan(Schema aSchema, HashIndex aIndex, SearchKey aKey, HeapFile aFile) {
throw new UnsupportedOperationException("Not implemented");
this.schema = aSchema;
this.index = aIndex;
this.key = aKey;
this.file = aFile;
this.scan = this.index.openScan(this.key);
this.isOpen = true;
}
/**
@ -29,21 +39,28 @@ public class KeyScan extends Iterator {
* Restarts the iterator, i.e. as if it were just constructed.
*/
public void restart() {
throw new UnsupportedOperationException("Not implemented");
this.isOpen = false; // In case of errors maybe?
this.close();
this.scan = this.index.openScan(this.key);
this.isOpen = true;
}
/**
* Returns true if the iterator is open; false otherwise.
*/
public boolean isOpen() {
throw new UnsupportedOperationException("Not implemented");
return this.isOpen;
}
/**
* Closes the iterator, releasing any resources (i.e. pinned pages).
*/
public void close() {
throw new UnsupportedOperationException("Not implemented");
if (this.isOpen()) {
this.scan.close();
this.scan = null;
this.isOpen = false;
}
}
/**