Interface IConditionExpr
- All Superinterfaces:
Externalizable
- All Known Implementing Classes:
XPathConditional
public interface IConditionExpr extends Externalizable
A condition expression is an expression which is evaluated against the current
model and produces a value. These objects should keep track of the expression that
they evaluate, as well as being able to identify what references will require the
condition to be triggered.
As a metaphor into an XForm, a Condition expression represents an XPath expression
which you can query for a value (in a calculate or relevancy condition, for instance),
can tell you what nodes its value will depend on, and optionally what values it "Pivots"
around. (IE: if an expression's value is true if a node is > 25, and false otherwise, it
has a "Comparison Pivot" around 25).
- Author:
- ctsims
-
Method Summary
Modifier and Type Method Description booleaneval(DataInstance model, EvaluationContext evalContext)Evaluate this expression against the current models and context and provide a true or false value.List<TreeReference>evalNodeset(DataInstance model, EvaluationContext evalContext)Used for itemsets.ObjectevalRaw(DataInstance model, EvaluationContext evalContext)Evaluate this expression against the current models and context and provide the final value of the expression, without forcing a cast to a boolean value.StringevalReadable(DataInstance model, EvaluationContext evalContext)Used for itemsets.Set<TreeReference>getTriggers(TreeReference contextRef)Provides a list of all of the references that this expression's value depends upon directly.List<Object>pivot(DataInstance model, EvaluationContext evalContext)Provide a list of Pivots around which this Condition Expression depends.Methods inherited from interface org.javarosa.core.util.externalizable.Externalizable
readExternal, writeExternal
-
Method Details
-
eval
Evaluate this expression against the current models and context and provide a true or false value.- Parameters:
model-evalContext-- Returns:
-
evalRaw
Evaluate this expression against the current models and context and provide the final value of the expression, without forcing a cast to a boolean value.- Parameters:
model-evalContext-- Returns:
-
evalReadable
Used for itemsets. Fill this documentation in.- Parameters:
model-evalContext-- Returns:
-
evalNodeset
Used for itemsets. Fill this documentation in.- Parameters:
model-evalContext-- Returns:
-
getTriggers
Provides a list of all of the references that this expression's value depends upon directly. These values can't be contextualized fully (since these triggers are necessary before runtime), but should only need to be contextualized to be a complete set.- Returns:
-
pivot
List<Object> pivot(DataInstance model, EvaluationContext evalContext) throws UnpivotableExpressionExceptionProvide a list of Pivots around which this Condition Expression depends. Optional to implement. If not implemented, throw an Unpivotable Expression exception to signal that the expression cannot be statically evaluated.- Parameters:
model-evalContext-- Returns:
- Throws:
UnpivotableExpressionException
-