Class CompoundSlotAccessor
java.lang.Object
net.ssehub.easy.varModel.cstEvaluation.EvaluationAccessor
net.ssehub.easy.varModel.cstEvaluation.AbstractDecisionVariableEvaluationAccessor
net.ssehub.easy.varModel.cstEvaluation.CompoundSlotAccessor
Implements an accessor for decision variables. This class supports
IEvaluationInterceptor.- Author:
- Holger Eichelberger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.ssehub.easy.basics.pool.Pool<CompoundSlotAccessor> private IDecisionVariable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate final booleanassignValue(Value value, boolean asAssignment) Assigns the value.bind(IDecisionVariable variable, String slotName, EvaluationContext context) Binds the accessor to the given variable and context.bind(LocalDecisionVariable variable, String slotName, EvaluationContext context) Binds the accessor to the given variable and context.voidclear()Clears the accessor for reuse.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.voidrelease()Releases this instance.booleanDefines a new value for the accessed element.Methods inherited from class net.ssehub.easy.varModel.cstEvaluation.AbstractDecisionVariableEvaluationAccessor
bind, getReferenceValue, isLocal, notifyVariableChange, toStringMethods inherited from class net.ssehub.easy.varModel.cstEvaluation.EvaluationAccessor
addBoundContainerElement, addBoundContainerElement, bind, bindContainer, bindContainer, clearContainerElements, dereferenceIfNeeded, getBoundContainerElement, getBoundContainerElementCount, getContext, getDereferencedValue, isAssigned, isConstant, release, setValue, validateContext
-
Field Details
-
POOL
-
slotVariable
-
-
Constructor Details
-
CompoundSlotAccessor
private CompoundSlotAccessor()Creates an instance. Private due to pooling.
-
-
Method Details
-
bind
public CompoundSlotAccessor bind(IDecisionVariable variable, String slotName, EvaluationContext context) Binds the accessor to the given variable and context.- Parameters:
variable- the underlying variableslotName- the name of the slot withinvaluecontext- the evaluation context- Returns:
- this (builder pattern)
-
bind
public CompoundSlotAccessor bind(LocalDecisionVariable variable, String slotName, EvaluationContext context) Binds the accessor to the given variable and context.- Parameters:
variable- the underlying variableslotName- the name of the slot withinvaluecontext- the evaluation context- Returns:
- this (builder pattern)
-
clear
public void clear()Description copied from class:EvaluationAccessorClears the accessor for reuse.- Overrides:
clearin classAbstractDecisionVariableEvaluationAccessor
-
getValue
Description copied from class:EvaluationAccessorReturns the value of the accessed element.- Specified by:
getValuein classEvaluationAccessor- Returns:
- the value (may be null if undefined)
-
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
-
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
-
assignValue
Assigns the value.- Parameters:
value- the valueasAssignment- does this happen through an IVML assignment operation- Returns:
- whether the assignment was successful or not
-
getVariable
Description copied from class:EvaluationAccessorReturns the underlying variable.- Overrides:
getVariablein classAbstractDecisionVariableEvaluationAccessor- Returns:
- the underlying variable (may be null)
-
release
public void release()Description copied from class:EvaluationAccessorReleases this instance.- Specified by:
releasein classEvaluationAccessor
-
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
-