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;
@ -70,7 +69,7 @@ public class FileScan extends Iterator {
/**
* Gets the next tuple in the iteration.
*
*
* @throws IllegalStateException if no more tuples
*/
public Tuple getNext() {
@ -83,7 +82,7 @@ public class FileScan extends Iterator {
public RID getLastRID() {
return rid;
}
// getter; added so HashJoin doesn't have to copy the file;
public HeapFile getFile(){
return file;

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;
}
/**
@ -22,44 +32,51 @@ public class KeyScan extends Iterator {
* child iterators, and increases the indent depth along the way.
*/
public void explain(int depth) {
throw new UnsupportedOperationException("Not implemented");
throw new UnsupportedOperationException("Not implemented");
}
/**
* 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;
}
}
/**
* Returns true if there are more tuples, false otherwise.
*/
public boolean hasNext() {
throw new UnsupportedOperationException("Not implemented");
throw new UnsupportedOperationException("Not implemented");
}
/**
* Gets the next tuple in the iteration.
*
*
* @throws IllegalStateException if no more tuples
*/
public Tuple getNext() {
throw new UnsupportedOperationException("Not implemented");
throw new UnsupportedOperationException("Not implemented");
}
} // public class KeyScan extends Iterator