Class IndexAccessor
java.lang.Object
net.ssehub.easy.varModel.cstEvaluation.EvaluationAccessor
net.ssehub.easy.varModel.cstEvaluation.AbstractDecisionVariableEvaluationAccessor
net.ssehub.easy.varModel.cstEvaluation.IndexAccessor
Implements an accessor for index access. May lead to a constant value after evaluation.
- Author:
- Holger Eichelberger
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intstatic final net.ssehub.easy.basics.pool.Pool<IndexAccessor> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected IndexAccessorbind(IDecisionVariable variable, EvaluationContext context, int index) Binds this accessor.Returns the value of a reference to the accessed element.getValue()Returns the value of the accessed element.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, clear, getVariable, isLocal, notifyVariableChange, toStringMethods inherited from class net.ssehub.easy.varModel.cstEvaluation.EvaluationAccessor
addBoundContainerElement, addBoundContainerElement, bind, bindContainer, bindContainer, clearContainerElements, dereferenceIfNeeded, getBoundContainerElement, getBoundContainerElementCount, getContext, getDereferencedValue, getValue, isAssigned, isConstant, release, setValue, validateContext
-
Field Details
-
POOL
-
index
private int index
-
-
Constructor Details
-
IndexAccessor
private IndexAccessor()Creates an instance. Private due to pooling.
-
-
Method Details
-
bind
Binds this accessor.- Parameters:
variable- the underlying variablecontext- the evaluation contextindex- the index into the variable- Returns:
- this (builder pattern)
-
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
-
getReferenceValue
Description copied from class:EvaluationAccessorReturns the value of a reference to the accessed element.- Overrides:
getReferenceValuein classAbstractDecisionVariableEvaluationAccessor- Returns:
- the value (may be null if undefined)
-