Class InstanceSelection
java.lang.Object
com.aquima.interactions.framework.util.InstanceSelection
Class to parse/filter instances from expressions.
- Since:
- 5.1
- Author:
- Jon van Leuven
-
Constructor Summary
ConstructorsConstructorDescriptionInstanceSelection
(InferenceContext context, IExpressionParser parser) Construct an instance of InstanceSelection. -
Method Summary
Modifier and TypeMethodDescriptionfilterInstances
(IEntityInstance[] instances, String expressionString, String type) Filter instances based on an expression which is applied to all instances, when evaluated to true the instance will be included in the result.parseInstances
(String expressionString) Parse instances from a string expression.
-
Constructor Details
-
InstanceSelection
Construct an instance of InstanceSelection.- Parameters:
context
- cannot be nullparser
- cannot be null
-
-
Method Details
-
filterInstances
public IEntityInstance[] filterInstances(IEntityInstance[] instances, String expressionString, String type) Filter instances based on an expression which is applied to all instances, when evaluated to true the instance will be included in the result.- Parameters:
instances
- instances to filter, cannot be nullexpressionString
- expression evaluating to a boolean value that is applied to every instance. When null, no filter will be applied.type
- Optional parameter containing the requested type of instances (all instances that are not of this type will be discarded).- Returns:
- a filtered subset of the instances
- Throws:
ConversionException
- is thrown when the expression could not be evaluated.RuleEngineException
- is thrown when the expressionString is an invalid expression
-
parseInstances
Parse instances from a string expression.- Parameters:
expressionString
- An expression that evaluates to one or a collection of instances.- Returns:
- the instances returned by evaluating the expression.
- Throws:
AppException
- when an error occursConversionException
- when the expression does not evaluate to instance values.
-