Class InstanceSelection

java.lang.Object
com.aquima.interactions.framework.util.InstanceSelection

public final class InstanceSelection extends Object
Class to parse/filter instances from expressions.
Since:
5.1
Author:
Jon van Leuven
  • Constructor Details

    • InstanceSelection

      public InstanceSelection(InferenceContext context, IExpressionParser parser)
      Construct an instance of InstanceSelection.
      Parameters:
      context - cannot be null
      parser - 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 null
      expressionString - 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

      public IEntityInstance[] parseInstances(String expressionString)
      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 occurs
      ConversionException - when the expression does not evaluate to instance values.