Package chemaxon.chemterms
Class ChemTermsExpression<C extends ChemTermsContext>
java.lang.Object
chemaxon.chemterms.ChemTermsExpression<C>
Expression parser and evaluator for chemical expressions.
- Since:
- JChem 2.2, Marvin 5.1
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidUpdates this object to represent the given expression.Returns the constant table used by this parser.Evaluates the expression.booleanevaluate_boolean(C context) Deprecated, for removal: This API element is subject to removal in a future version.boolean[]evaluate_booleans(C context) Deprecated, for removal: This API element is subject to removal in a future version.UseevaluateBooleanArray(C)instead.doubleevaluate_double(C context) Deprecated, for removal: This API element is subject to removal in a future version.UseevaluateDouble(C)instead.double[]evaluate_doubles(C context) Deprecated, for removal: This API element is subject to removal in a future version.UseevaluateDoubleArray(C)instead.booleanevaluateBoolean(C context) Evaluates the expression and converts the resultboolean.boolean[]evaluateBooleanArray(C context) Evaluates the expression and converts the result toboolean[].doubleevaluateDouble(C context) Evaluates the expression and converts the result todouble.double[]evaluateDoubleArray(C context) Evaluates the expression and converts the result todouble[].static intgetLogicalValue(Object result) static booleanisUndecided(Object result) Returns whether the result object is undecided.
-
Field Details
-
FALSE
public static final int FALSELogical result value: FALSE.- See Also:
-
TRUE
public static final int TRUELogical result value: TRUE.- See Also:
-
UNDECIDED
public static final int UNDECIDEDLogical result value: UNDECIDED.- See Also:
-
COMPILE_ERROR
The compilation error message.- See Also:
-
EVALUATION_ERROR
The evaluation error message.- See Also:
-
-
Method Details
-
constantTable
Returns the constant table used by this parser. -
compile
Updates this object to represent the given expression.- Parameters:
expression- is the expression string- Throws:
ParseException- on compile error
-
evaluate
Evaluates the expression.- Parameters:
context- is the evaluation context- Returns:
- the evaluation result
- Throws:
ParseException- on evaluation error
-
evaluate_double
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2027) public double evaluate_double(C context) throws ParseException Deprecated, for removal: This API element is subject to removal in a future version.UseevaluateDouble(C)instead.Evaluates the expression and converts the result todouble.- Parameters:
context- is the evaluation context- Returns:
- the evaluation result
- Throws:
ParseException- on evaluation error
-
evaluateDouble
Evaluates the expression and converts the result todouble.- Parameters:
context- is the evaluation context- Returns:
- the evaluation result
- Throws:
ParseException- on evaluation error
-
evaluate_doubles
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2027) public double[] evaluate_doubles(C context) throws ParseException Deprecated, for removal: This API element is subject to removal in a future version.UseevaluateDoubleArray(C)instead.Evaluates the expression and converts the result todouble[]. This is useful if the result is an object array in which case each element is converted todouble.- Parameters:
context- is the evaluation context- Returns:
- the evaluation result
- Throws:
ParseException- on evaluation error
-
evaluateDoubleArray
Evaluates the expression and converts the result todouble[]. This is useful if the result is an object array in which case each element is converted todouble.- Parameters:
context- is the evaluation context- Returns:
- the evaluation result
- Throws:
ParseException- on evaluation error
-
evaluate_boolean
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2027) public boolean evaluate_boolean(C context) throws ParseException Deprecated, for removal: This API element is subject to removal in a future version.UseevaluateBoolean(C)instead.Evaluates the expression and converts the resultboolean. Boolean return values are returned as double: 1.0 for true and 0.0 for false. This function returns true for a value greater than 0.5, false otherwise. This means that for boolean expressions the return value will be OK (and we also eliminated floating-point comparison inaccuracy :-).- Parameters:
context- is the evaluation context- Returns:
- the evaluation result
- Throws:
ParseException- on evaluation error
-
evaluateBoolean
Evaluates the expression and converts the resultboolean. Boolean return values are returned as double: 1.0 for true and 0.0 for false. This function returns true for a value greater than 0.5, false otherwise. This means that for boolean expressions the return value will be OK (and we also eliminated floating-point comparison inaccuracy :-).- Parameters:
context- is the evaluation context- Returns:
- the evaluation result
- Throws:
ParseException- on evaluation error
-
evaluate_booleans
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2027) public boolean[] evaluate_booleans(C context) throws ParseException Deprecated, for removal: This API element is subject to removal in a future version.UseevaluateBooleanArray(C)instead.Evaluates the expression and converts the result toboolean[]. This is useful if the result is an object array in which case each element is converted toboolean.- Parameters:
context- is the evaluation context- Returns:
- the evaluation result
- Throws:
ParseException- on evaluation error
-
evaluateBooleanArray
Evaluates the expression and converts the result toboolean[]. This is useful if the result is an object array in which case each element is converted toboolean.- Parameters:
context- is the evaluation context- Returns:
- the evaluation result
- Throws:
ParseException- on evaluation error
-
getLogicalValue
- Parameters:
result- is the result object- Returns:
- the corresponding logical value
- Since:
- JChem 3.2
-
isUndecided
Returns whether the result object is undecided.- Returns:
trueif the result is undecided
-
evaluateBoolean(C)instead.