Class EvaluationContext

    • Field Detail

      • locale

        private java.util.Locale locale
    • Constructor Detail

      • EvaluationContext

        public EvaluationContext()
    • Method Detail

      • clear

        void clear()
        Clears this instance for reuse.
      • getLocale

        public java.util.Locale getLocale()
        Returns the actual locale for evaluation.
        Returns:
        the locale
      • setLocale

        public void setLocale​(java.util.Locale locale)
        Changes the locale for evaluation.
        Parameters:
        locale - the new locale, ignored if null
      • getCollator

        public java.text.Collator getCollator()
        Returns the collator corresponding to the actual locale of this context.
        Returns:
        the collator
      • allowAssignValues

        public abstract boolean allowAssignValues()
        Returns whether values shall be assigned, i.e., the configuration may be changed.
        Returns:
        true if values shall be assigned, false else
      • notifyChangeListener

        public abstract void notifyChangeListener​(IDecisionVariable variable,
                                                  Value oldValue,
                                                  IAssignmentState oldState,
                                                  IValueChangeListener.ChangeKind kind)
        Notifies the change listener, i.e., the value of variable has changed.
        Parameters:
        variable - the changed variable
        oldValue - the value of variable before the change (may be null)
        oldState - the old state of variable before the change
        kind - the change kind
      • addMessage

        public abstract void addMessage​(EvaluationVisitor.Message message)
        Adds an evaluation message.
        Parameters:
        message - the message to be added
      • getTargetState

        public abstract IAssignmentState getTargetState​(IDecisionVariable variable)
        Returns the target state of the evaluation for variable.
        Parameters:
        variable - the variable to return the target state for (do not modify!!!)
        Returns:
        the target state (may be null if the actual value cannot be assigned do to a state conflict)
      • addErrorMessage

        public void addErrorMessage​(java.lang.String message,
                                    int code)
        Adds an evaluation error message.
        Parameters:
        message - the message to be added
        code - the error code
      • addErrorMessage

        public void addErrorMessage​(java.lang.String message,
                                    IDecisionVariable variable,
                                    int code)
        Adds an evaluation error message.
        Parameters:
        message - the message to be added
        variable - Optional IDecisionVariable which caused the error
        code - the error code
      • addErrorMessage

        public void addErrorMessage​(java.lang.Throwable throwable)
        Adds an evaluation error message based on a throwable.
        Parameters:
        throwable - the throwable carrying the message
      • issueWarning

        public abstract void issueWarning()
        Indicates that the evaluation of this constraint shall lead to a warning.
      • allowPropagation

        public abstract boolean allowPropagation()
        Returns whether the expression to be evaluated is a propagation.
        Returns:
        true if it is a propagation, i.e. propagation shall be allowed, false else
      • getDereferencedValue

        public Value getDereferencedValue​(Value value)
        Dereferences a value within this context.
        Parameters:
        value - the value to dereference
        Returns:
        the dereferenced value (may be null if undefined)