Main Page   Classes  

Public Member Functions | Static Public Member Functions | List of all members
Expression Class Reference

Public Member Functions

 Expression (String exprString) throws CodaException
 
void delete ()
 
ExpressionTypeEnum getType () throws CodaException
 
boolean isConstant ()
 
boolean isEqual (Expression expression)
 
boolean evalBool () throws CodaException
 
boolean evalBool (Cursor cursor) throws CodaException
 
long evalInteger () throws CodaException
 
long evalInteger (Cursor cursor) throws CodaException
 
double evalFloat () throws CodaException
 
double evalFloat (Cursor cursor) throws CodaException
 
String evalString () throws CodaException
 
String evalString (Cursor cursor) throws CodaException
 
void evalNode (Cursor cursor) throws CodaException
 

Static Public Member Functions

static String getTypeName (ExpressionTypeEnum type)
 

Detailed Description

CODA Expression class.

This class represents instances of CODA Expressions and provides methods to manipulate retrieve information about the expression.

Constructor & Destructor Documentation

◆ Expression()

Expression ( String exprString) throws CodaException

Create a new CODA expression object by parsing a string containing a CODA expression.

The string should contain a valid CODA expression. The returned expression object should be cleaned up using the delete() method after it has been used.

Parameters
exprStringA string containing the string representation of the CODA expression
Exceptions
CodaExceptionIf an error occurred.

Member Function Documentation

◆ delete()

void delete ( )

Delete the CODA expression object.

This will invalidate the Expression object. Note: the results of continuing to use an Expr object after this method has been called are undefined. Currently, no internal state is maintained by the object itself.

◆ evalBool() [1/2]

boolean evalBool ( ) throws CodaException

Evaluate a boolean expression. Shortcut for evalBool(null).

Returns
The resulting boolean value.
Exceptions
CodaExceptionIf an error occurred.

◆ evalBool() [2/2]

boolean evalBool ( Cursor cursor) throws CodaException

Evaluate a boolean expression. The expression object should be a coda_expression_bool expression. The function will evaluate the expression at the given cursor position and return the resulting boolean value.

Parameters
cursorCursor pointing to a location in the product where the boolean expression should be evaluated (can be NULL for constant expressions).
Returns
The resulting boolean value.
Exceptions
CodaExceptionIf an error occurred.

◆ evalFloat() [1/2]

double evalFloat ( ) throws CodaException

Evaluate a floating point expression. Shortcut for evalFloat(null).

Returns
The resulting floating point value.
Exceptions
CodaExceptionIf an error occurred.

◆ evalFloat() [2/2]

double evalFloat ( Cursor cursor) throws CodaException

Evaluate a floating point expression. The function will evaluate the expression at the given cursor position and return the resulting floating point value. The expression object should be a coda_expression_float expression.

Parameters
cursorCursor pointing to a location in the product where the boolean expression should be evaluated (can be NULL for constant expressions).
Returns
The resulting floating point value.
Exceptions
CodaExceptionIf an error occurred.

◆ evalInteger() [1/2]

long evalInteger ( ) throws CodaException

Evaluate an integer expression. Shortcut for evalInteger(null).

Returns
The resulting integer value (note that the the actual data type is 'long').
Exceptions
CodaExceptionIf an error occurred.

◆ evalInteger() [2/2]

long evalInteger ( Cursor cursor) throws CodaException

Evaluate an integer expression. The expression object should be a coda_expression_integer expression. The function will evaluate the expression at the given cursor position and return the resulting integer value.

Parameters
cursorCursor pointing to a location in the product where the boolean expression should be evaluated (can be NULL for constant expressions).
Returns
The resulting integer value (note that the the actual data type is 'long').
Exceptions
CodaExceptionIf an error occurred.

◆ evalNode()

void evalNode ( Cursor cursor) throws CodaException

Evaluate a node expression. The function will moves the cursor to a different position in a product based on the node expression. The expression object should be a coda_expr_node expression.

Parameters
cursorCursor pointing to a location in the product where the boolean expression should be evaluated.
Exceptions
CodaExceptionIf an error occurred.

◆ evalString() [1/2]

String evalString ( ) throws CodaException

Evaluate a string expression. Shortcut for evalString(null).

Returns
The resulting string value.
Exceptions
CodaExceptionIf an error occurred.

◆ evalString() [2/2]

String evalString ( Cursor cursor) throws CodaException

Evaluate a string expression. The function will evaluate the expression at the given cursor position (if provided) and return the resulting string. If a string is returned then it will be zero terminated. However, in the case where the string itself also contains zero characters, strlen() can not be used and the length parameter will give the actual string length of value. The expression object should be a coda_expression_string expression

Parameters
cursorCursor pointing to a location in the product where the boolean expression should be evaluated (can be NULL for constant expressions).
Returns
The resulting string value.
Exceptions
CodaExceptionIf an error occurred.

◆ getType()

ExpressionTypeEnum getType ( ) throws CodaException

Retrieve the result type of a CODA expression.

Returns
The result type of the CODA expression.
Exceptions
CodaExceptionIf an error occurred.

◆ getTypeName()

static String getTypeName ( ExpressionTypeEnum type)
static

Returns the name of an expression type.

Parameters
typeCODA expression type
Returns
if the type is known a string containing the name of the type, otherwise the string "unknown".

◆ isConstant()

boolean isConstant ( )

Return whether an expression is constant or not.

An expression is constant if it does not depend on the contents of a product and if the expression evaluation function can be called with cursor=null.

Returns
true if the expression is constant, false if not.

◆ isEqual()

boolean isEqual ( Expression expression)

Return whether an expression is equal to another expression or not.

Returns
true if the expression matches the given expression, false if not.