simpledb.query
Interface Expression

All Known Implementing Classes:
ConstantExpression, FieldNameExpression

public interface Expression

The interface corresponding to SQL expressions.

Author:
Edward Sciore

Method Summary
 boolean appliesTo(Schema sch)
          Determines if all of the fields mentioned in this expression are contained in the specified schema.
 Constant asConstant()
          Returns the constant corresponding to a constant expression.
 String asFieldName()
          Returns the field name corresponding to a constant expression.
 Constant evaluate(Scan s)
          Evaluates the expression with respect to the current record of the specified scan.
 boolean isConstant()
          Returns true if the expression is a constant.
 boolean isFieldName()
          Returns true if the expression is a field reference.
 

Method Detail

isConstant

boolean isConstant()
Returns true if the expression is a constant.

Returns:
true if the expression is a constant

isFieldName

boolean isFieldName()
Returns true if the expression is a field reference.

Returns:
true if the expression denotes a field

asConstant

Constant asConstant()
Returns the constant corresponding to a constant expression. Throws an exception if the expression does not denote a constant.

Returns:
the expression as a constant

asFieldName

String asFieldName()
Returns the field name corresponding to a constant expression. Throws an exception if the expression does not denote a field.

Returns:
the expression as a field name

evaluate

Constant evaluate(Scan s)
Evaluates the expression with respect to the current record of the specified scan.

Parameters:
s - the scan
Returns:
the value of the expression, as a Constant

appliesTo

boolean appliesTo(Schema sch)
Determines if all of the fields mentioned in this expression are contained in the specified schema.

Parameters:
sch - the schema
Returns:
true if all fields in the expression are in the schema


Copyright © 2011. All Rights Reserved.