simpledb.index.query
Class IndexSelectScan

java.lang.Object
  extended by simpledb.index.query.IndexSelectScan
All Implemented Interfaces:
Scan

public class IndexSelectScan
extends Object
implements Scan

The scan class corresponding to the select relational algebra operator.

Author:
Edward Sciore

Constructor Summary
IndexSelectScan(Index idx, Constant val, TableScan ts)
          Creates an index select scan for the specified index and selection constant.
 
Method Summary
 void beforeFirst()
          Positions the scan before the first record, which in this case means positioning the index before the first instance of the selection constant.
 void close()
          Closes the scan by closing the index and the tablescan.
 int getInt(String fldname)
          Returns the value of the field of the current data record.
 String getString(String fldname)
          Returns the value of the field of the current data record.
 Constant getVal(String fldname)
          Returns the value of the field of the current data record.
 boolean hasField(String fldname)
          Returns whether the data record has the specified field.
 boolean next()
          Moves to the next record, which in this case means moving the index to the next record satisfying the selection constant, and returning false if there are no more such index records.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexSelectScan

public IndexSelectScan(Index idx,
                       Constant val,
                       TableScan ts)
Creates an index select scan for the specified index and selection constant.

Parameters:
idx - the index
val - the selection constant
Method Detail

beforeFirst

public void beforeFirst()
Positions the scan before the first record, which in this case means positioning the index before the first instance of the selection constant.

Specified by:
beforeFirst in interface Scan
See Also:
Scan.beforeFirst()

next

public boolean next()
Moves to the next record, which in this case means moving the index to the next record satisfying the selection constant, and returning false if there are no more such index records. If there is a next record, the method moves the tablescan to the corresponding data record.

Specified by:
next in interface Scan
Returns:
false if there is no next record
See Also:
Scan.next()

close

public void close()
Closes the scan by closing the index and the tablescan.

Specified by:
close in interface Scan
See Also:
Scan.close()

getVal

public Constant getVal(String fldname)
Returns the value of the field of the current data record.

Specified by:
getVal in interface Scan
Parameters:
fldname - the name of the field
Returns:
the value of that field, expressed as a Constant.
See Also:
Scan.getVal(java.lang.String)

getInt

public int getInt(String fldname)
Returns the value of the field of the current data record.

Specified by:
getInt in interface Scan
Parameters:
fldname - the name of the field
Returns:
the field's integer value in the current record
See Also:
Scan.getInt(java.lang.String)

getString

public String getString(String fldname)
Returns the value of the field of the current data record.

Specified by:
getString in interface Scan
Parameters:
fldname - the name of the field
Returns:
the field's string value in the current record
See Also:
Scan.getString(java.lang.String)

hasField

public boolean hasField(String fldname)
Returns whether the data record has the specified field.

Specified by:
hasField in interface Scan
Parameters:
fldname - the name of the field
Returns:
true if the scan has that field
See Also:
Scan.hasField(java.lang.String)


Copyright © 2011. All Rights Reserved.