Class VariableAccessor

    • Constructor Detail

      • VariableAccessor

        private VariableAccessor()
        Creates an instance. Private due to pooling.
    • Method Detail

      • bind

        public VariableAccessor bind​(AbstractVariable variable,
                                     EvaluationContext context)
        Binds the accessor to the given variable and context.
        Parameters:
        variable - the underlying variable
        context - the evaluation context
        Returns:
        this (builder pattern)
      • bind

        public VariableAccessor bind​(IDecisionVariable variable,
                                     EvaluationContext context,
                                     boolean isLocal)
        Binds the accessor to the given (local or non-local) variable and context.
        Parameters:
        variable - the underlying variable
        context - the evaluation context
        isLocal - whether the variable is local and does not need a target state check
        Returns:
        this (builder pattern)
      • setValue

        public boolean setValue​(Value value,
                                boolean asAssignment)
        Description copied from class: EvaluationAccessor
        Defines a new value for the accessed element. In case of failures, add appropriate messages to the context.
        Specified by:
        setValue in class EvaluationAccessor
        Parameters:
        value - the new value
        asAssignment - does this happen through an IVML assignment operation
        Returns:
        true if successful, false else
      • setValue

        private boolean setValue​(EvaluationContext context,
                                 Value value,
                                 boolean asAssignment)
        Changes the value within the given evaluation context.
        Parameters:
        context - the evaluation context
        value - the new value
        asAssignment - called within an assignment or equality expression
        Returns:
        true for success, false else
      • isAssignable

        public boolean isAssignable()
        Description copied from class: EvaluationAccessor
        Returns whether values can be assigned to this evaluator.
        Specified by:
        isAssignable in class EvaluationAccessor
        Returns:
        true if values can be assigned, false else
      • getIndex

        private java.lang.Integer getIndex​(ContainerValue value,
                                           EvaluationAccessor accessor)
        Returns the (valid) index from accessor for value.
        Parameters:
        value - the container to be accessed
        accessor - the accessor expression
        Returns:
        the index value (invalid if null)
      • setValue

        public void setValue​(EvaluationAccessor accessor,
                             Value value)
        Changes a nested value based on the given accessor.
        Overrides:
        setValue in class EvaluationAccessor
        Parameters:
        accessor - the accessor to determine the nested value
        value - the new nested value