Class CompoundSlotAccessor
- java.lang.Object
-
- net.ssehub.easy.varModel.cstEvaluation.EvaluationAccessor
-
- net.ssehub.easy.varModel.cstEvaluation.AbstractDecisionVariableEvaluationAccessor
-
- net.ssehub.easy.varModel.cstEvaluation.CompoundSlotAccessor
-
class CompoundSlotAccessor extends AbstractDecisionVariableEvaluationAccessor
Implements an accessor for decision variables.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description static Pool<CompoundSlotAccessor>POOLprivate IDecisionVariableslotVariable
-
Constructor Summary
Constructors Modifier Constructor Description privateCompoundSlotAccessor()Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanassignValue(Value value, boolean asAssignment)Assigns the value.CompoundSlotAccessorbind(IDecisionVariable variable, java.lang.String slotName, EvaluationContext context)Binds the accessor to the given variable and context.CompoundSlotAccessorbind(LocalDecisionVariable variable, java.lang.String slotName, EvaluationContext context)Binds the accessor to the given variable and context.voidclear()Clears the accessor for reuse.ValuegetValue()Returns the value of the accessed element.EvaluationAccessorgetValue(EvaluationAccessor accessor)Returns a nested value based on the given accessor.IDecisionVariablegetVariable()Returns the underlying variable.booleanisAssignable()Returns whether values can be assigned to this evaluator.voidrelease()Releases this instance.booleansetValue(Value value, boolean asAssignment)Defines a new value for the accessed element.-
Methods inherited from class net.ssehub.easy.varModel.cstEvaluation.AbstractDecisionVariableEvaluationAccessor
bind, getReferenceValue, isLocal, notifyVariableChange, toString
-
Methods 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 Detail
-
POOL
public static final Pool<CompoundSlotAccessor> POOL
-
slotVariable
private IDecisionVariable slotVariable
-
-
Method Detail
-
bind
public CompoundSlotAccessor bind(IDecisionVariable variable, java.lang.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, java.lang.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
public Value 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
public EvaluationAccessor getValue(EvaluationAccessor accessor)
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
public boolean setValue(Value value, boolean asAssignment)
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
private final boolean assignValue(Value value, boolean asAssignment)
Assigns the value.- Parameters:
value- the valueasAssignment- does this happen through an IVML assignment operation- Returns:
- whether the assignment was successful or not
-
getVariable
public IDecisionVariable 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
-
-