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) |
CODA Expression class.
This class represents instances of CODA Expressions and provides methods to manipulate retrieve information about the 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.
exprString | A string containing the string representation of the CODA expression |
CodaException | If an error occurred. |
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.
boolean evalBool | ( | ) | throws CodaException |
Evaluate a boolean expression. Shortcut for evalBool(null).
CodaException | If an error occurred. |
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.
cursor | Cursor pointing to a location in the product where the boolean expression should be evaluated (can be NULL for constant expressions). |
CodaException | If an error occurred. |
double evalFloat | ( | ) | throws CodaException |
Evaluate a floating point expression. Shortcut for evalFloat(null).
CodaException | If an error occurred. |
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.
cursor | Cursor pointing to a location in the product where the boolean expression should be evaluated (can be NULL for constant expressions). |
CodaException | If an error occurred. |
long evalInteger | ( | ) | throws CodaException |
Evaluate an integer expression. Shortcut for evalInteger(null).
CodaException | If an error occurred. |
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.
cursor | Cursor pointing to a location in the product where the boolean expression should be evaluated (can be NULL for constant expressions). |
CodaException | If an error occurred. |
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.
cursor | Cursor pointing to a location in the product where the boolean expression should be evaluated. |
CodaException | If an error occurred. |
String evalString | ( | ) | throws CodaException |
Evaluate a string expression. Shortcut for evalString(null).
CodaException | If an error occurred. |
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
cursor | Cursor pointing to a location in the product where the boolean expression should be evaluated (can be NULL for constant expressions). |
CodaException | If an error occurred. |
ExpressionTypeEnum getType | ( | ) | throws CodaException |
Retrieve the result type of a CODA expression.
CodaException | If an error occurred. |
|
static |
Returns the name of an expression type.
type | CODA expression type |
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.
boolean isEqual | ( | Expression | expression | ) |
Return whether an expression is equal to another expression or not.