simpledb.query
Class ProductScan

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

public class ProductScan
extends Object
implements Scan

The scan class corresponding to the product relational algebra operator.

Author:
Edward Sciore

Constructor Summary
ProductScan(Scan s1, Scan s2)
          Creates a product scan having the two underlying scans.
 
Method Summary
 void beforeFirst()
          Positions the scan before its first record.
 void close()
          Closes both underlying scans.
 int getInt(String fldname)
          Returns the integer value of the specified field.
 String getString(String fldname)
          Returns the string value of the specified field.
 Constant getVal(String fldname)
          Returns the value of the specified field.
 boolean hasField(String fldname)
          Returns true if the specified field is in either of the underlying scans.
 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

ProductScan

public ProductScan(Scan s1,
                   Scan s2)
Creates a product scan having the two underlying scans.

Parameters:
s1 - the LHS scan
s2 - the RHS scan
Method Detail

beforeFirst

public void beforeFirst()
Positions the scan before its first record. In other words, the LHS scan is positioned at its first record, and the RHS scan is positioned before its first record.

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

next

public boolean next()
Moves the scan to the next record. The method moves to the next RHS record, if possible. Otherwise, it moves to the next LHS record and the first RHS record. If there are no more LHS records, the method returns false.

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

close

public void close()
Closes both underlying scans.

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

getVal

public Constant getVal(String fldname)
Returns the value of the specified field. The value is obtained from whichever scan contains the field.

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 integer value of the specified field. The value is obtained from whichever scan contains the field.

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 string value of the specified field. The value is obtained from whichever scan contains the field.

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 true if the specified field is in either of the underlying scans.

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.