Class ConstantAccessor
java.lang.Object
net.ssehub.easy.varModel.cstEvaluation.EvaluationAccessor
net.ssehub.easy.varModel.cstEvaluation.ConstantAccessor
Implements an accessor for constant values. [public for testing]
- Author:
- Holger Eichelberger
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanstatic final net.ssehub.easy.basics.pool.Pool<ConstantAccessor> private Value -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbind(Value value, boolean isConstant, EvaluationContext context) Binds the accessor to the given value and context.voidclear()Clears the accessor for reuse.Returns the value of a reference to the accessed element.getValue()Returns the value of the accessed element.getValue(EvaluationAccessor accessor) Returns a nested value based on the given accessor.Returns the underlying variable.booleanReturns whether values can be assigned to this evaluator.booleanReturns 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.voidrelease()Releases this instance.booleanDefines a new value for the accessed element.toString()Methods inherited from class net.ssehub.easy.varModel.cstEvaluation.EvaluationAccessor
addBoundContainerElement, addBoundContainerElement, bind, bindContainer, bindContainer, clearContainerElements, dereferenceIfNeeded, getBoundContainerElement, getBoundContainerElementCount, getContext, getDereferencedValue, isAssigned, release, setValue, validateContext
-
Field Details
-
POOL
-
value
-
isConstant
private boolean isConstant
-
-
Constructor Details
-
ConstantAccessor
private ConstantAccessor()Creates an instance. Private due to pooling.
-
-
Method Details
-
bind
Binds the accessor to the given value and context.- Parameters:
value- the actual valueisConstant- whethervalueis still (potentially) linked by reference to a decision variable (false), else whether it is actually a truely constantcontext- the evaluation context- Returns:
- this (builder pattern)
-
clear
public void clear()Description copied from class:EvaluationAccessorClears the accessor for reuse.- Overrides:
clearin classEvaluationAccessor
-
getValue
Description copied from class:EvaluationAccessorReturns the value of the accessed element.- Specified by:
getValuein classEvaluationAccessor- Returns:
- the value (may be null if undefined)
-
setValue
Description copied from class:EvaluationAccessorDefines a new value for the accessed element. In case of failures, add appropriate messages to the context.- Specified by:
setValuein classEvaluationAccessor- Parameters:
value- the new valueasAssignment- does this happen through an IVML assignment operation- Returns:
trueif successful,falseelse
-
isAssignable
public boolean isAssignable()Description copied from class:EvaluationAccessorReturns whether values can be assigned to this evaluator.- Specified by:
isAssignablein classEvaluationAccessor- Returns:
trueif values can be assigned,falseelse
-
release
public void release()Description copied from class:EvaluationAccessorReleases this instance.- Specified by:
releasein classEvaluationAccessor
-
getVariable
Description copied from class:EvaluationAccessorReturns the underlying variable.- Specified by:
getVariablein classEvaluationAccessor- Returns:
- the underlying variable (may be null)
-
getValue
Description copied from class:EvaluationAccessorReturns a nested value based on the given accessor.- Overrides:
getValuein classEvaluationAccessor- Parameters:
accessor- the accessor to determine the nested value- Returns:
- the nested value
-
getReferenceValue
Description copied from class:EvaluationAccessorReturns the value of a reference to the accessed element.- Specified by:
getReferenceValuein classEvaluationAccessor- Returns:
- the value (may be null if undefined)
-
toString
-
isConstant
public boolean isConstant()Description copied from class:EvaluationAccessorReturns 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:
isConstantin classEvaluationAccessor- Returns:
truefor constant,falseelse
-