Class ConstantAccessor

java.lang.Object
net.ssehub.easy.varModel.cstEvaluation.EvaluationAccessor
net.ssehub.easy.varModel.cstEvaluation.ConstantAccessor

public class ConstantAccessor extends EvaluationAccessor
Implements an accessor for constant values. [public for testing]
Author:
Holger Eichelberger
  • Field Details

    • POOL

      public static final net.ssehub.easy.basics.pool.Pool<ConstantAccessor> POOL
    • value

      private Value value
    • isConstant

      private boolean isConstant
  • Constructor Details

    • ConstantAccessor

      private ConstantAccessor()
      Creates an instance. Private due to pooling.
  • Method Details

    • bind

      public ConstantAccessor bind(Value value, boolean isConstant, EvaluationContext context)
      Binds the accessor to the given value and context.
      Parameters:
      value - the actual value
      isConstant - whether value is still (potentially) linked by reference to a decision variable (false), else whether it is actually a truely constant
      context - the evaluation context
      Returns:
      this (builder pattern)
    • clear

      public void clear()
      Description copied from class: EvaluationAccessor
      Clears the accessor for reuse.
      Overrides:
      clear in class EvaluationAccessor
    • getValue

      public Value getValue()
      Description copied from class: EvaluationAccessor
      Returns the value of the accessed element.
      Specified by:
      getValue in class EvaluationAccessor
      Returns:
      the value (may be null if undefined)
    • 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
    • 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
    • release

      public void release()
      Description copied from class: EvaluationAccessor
      Releases this instance.
      Specified by:
      release in class EvaluationAccessor
    • getVariable

      public IDecisionVariable getVariable()
      Description copied from class: EvaluationAccessor
      Returns the underlying variable.
      Specified by:
      getVariable in class EvaluationAccessor
      Returns:
      the underlying variable (may be null)
    • getValue

      public EvaluationAccessor getValue(EvaluationAccessor accessor)
      Description copied from class: EvaluationAccessor
      Returns a nested value based on the given accessor.
      Overrides:
      getValue in class EvaluationAccessor
      Parameters:
      accessor - the accessor to determine the nested value
      Returns:
      the nested value
    • getReferenceValue

      public Value getReferenceValue()
      Description copied from class: EvaluationAccessor
      Returns the value of a reference to the accessed element.
      Specified by:
      getReferenceValue in class EvaluationAccessor
      Returns:
      the value (may be null if undefined)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isConstant

      public boolean isConstant()
      Description copied from class: EvaluationAccessor
      Returns whether this accessor represents a constant in the sense of the evaluation process, i.e., a value that is already evaluated to its very end and not linked to any decision variable.
      Overrides:
      isConstant in class EvaluationAccessor
      Returns:
      true for constant, false else