Class IndexAccessor
- java.lang.Object
-
- net.ssehub.easy.varModel.cstEvaluation.EvaluationAccessor
-
- net.ssehub.easy.varModel.cstEvaluation.AbstractDecisionVariableEvaluationAccessor
-
- net.ssehub.easy.varModel.cstEvaluation.IndexAccessor
-
class IndexAccessor extends AbstractDecisionVariableEvaluationAccessor
Implements an accessor for index access. May lead to a constant value after evaluation.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private intindexstatic Pool<IndexAccessor>POOL
-
Constructor Summary
Constructors Modifier Constructor Description privateIndexAccessor()Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected IndexAccessorbind(IDecisionVariable variable, EvaluationContext context, int index)Binds this accessor.ValuegetReferenceValue()Returns the value of a reference to the accessed element.ValuegetValue()Returns the value of the accessed element.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, clear, getVariable, isLocal, notifyVariableChange, toString
-
Methods 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 Detail
-
POOL
public static final Pool<IndexAccessor> POOL
-
index
private int index
-
-
Method Detail
-
bind
protected IndexAccessor bind(IDecisionVariable variable, EvaluationContext context, int index)
Binds this accessor.- Parameters:
variable- the underlying variablecontext- the evaluation contextindex- the index into the variable- Returns:
- this (builder pattern)
-
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)
-
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
-
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
public Value 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)
-
-