simpledb.query
Class ProjectScan

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

public class ProjectScan
extends Object
implements Scan

The scan class corresponding to the project relational algebra operator. All methods except hasField delegate their work to the underlying scan.

Author:
Edward Sciore

Constructor Summary
ProjectScan(Scan s, Collection<String> fieldlist)
          Creates a project scan having the specified underlying scan and field list.
 
Method Summary
 void beforeFirst()
          Positions the scan before its first record.
 void close()
          Closes the scan and its subscans, if any.
 int getInt(String fldname)
          Returns the value of the specified integer field in the current record.
 String getString(String fldname)
          Returns the value of the specified string field in the current record.
 Constant getVal(String fldname)
          Returns the value of the specified field in the current record.
 boolean hasField(String fldname)
          Returns true if the specified field is in the projection list.
 boolean next()
          Moves the scan to the next record.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProjectScan

public ProjectScan(Scan s,
                   Collection<String> fieldlist)
Creates a project scan having the specified underlying scan and field list.

Parameters:
s - the underlying scan
fieldlist - the list of field names
Method Detail

beforeFirst

public void beforeFirst()
Description copied from interface: Scan
Positions the scan before its first record.

Specified by:
beforeFirst in interface Scan

next

public boolean next()
Description copied from interface: Scan
Moves the scan to the next record.

Specified by:
next in interface Scan
Returns:
false if there is no next record

close

public void close()
Description copied from interface: Scan
Closes the scan and its subscans, if any.

Specified by:
close in interface Scan

getVal

public Constant getVal(String fldname)
Description copied from interface: Scan
Returns the value of the specified field in the current record. The value is expressed as a Constant.

Specified by:
getVal in interface Scan
Parameters:
fldname - the name of the field
Returns:
the value of that field, expressed as a Constant.

getInt

public int getInt(String fldname)
Description copied from interface: Scan
Returns the value of the specified integer field in the current record.

Specified by:
getInt in interface Scan
Parameters:
fldname - the name of the field
Returns:
the field's integer value in the current record

getString

public String getString(String fldname)
Description copied from interface: Scan
Returns the value of the specified string field in the current record.

Specified by:
getString in interface Scan
Parameters:
fldname - the name of the field
Returns:
the field's string value in the current record

hasField

public boolean hasField(String fldname)
Returns true if the specified field is in the projection list.

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.