Interface IDecisionVariable
-
- All Superinterfaces:
IConfigurationElement,IConfigurationVisitable,IValueParent
- All Known Implementing Classes:
AbstractIvmlVariable.DecVar,BasisVariable,CompoundVariable,ContainerVariable,DecisionVariable,LocalDecisionVariable,SequenceVariable,SetVariable,StructuredVariable
public interface IDecisionVariable extends IConfigurationElement, IConfigurationVisitable, IValueParent
Interface for configurableDecisionVariable. Contrary toIConfigurationElement, this interface is only for elements of theConfiguration, not theConfigurationitself.- Author:
- El-Sharkawy
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanenableWasAssignedForIsDefined()Shall we take the localwasAssigned()overIConfigurationElement.getState()in the implementation of IVML "isDefined".IDecisionVariablegetAttribute(int index)Returns a specific attribute.intgetAttributesCount()Returns the number of attributes.intgetNestedDepth()Returns how many parentIDecisionVariables exist for this variable.IDecisionVariablegetNestedElement(int index)Returns the element specified byindex.IDecisionVariablegetNestedElement(java.lang.String name)Returns an element specified by its name.intgetNestedElementsCount()Returns the number of nested elements.java.lang.StringgetQualifiedName()Returns the qualified name of the declaration instance.IResolutionPathElementgetResolutionPath()Returns a resolution path for this variable.ValuegetValue()Returns the current value of thisIDecisionVariable.booleanhasNullValue()Checks whether the variable has aNullValue.booleanhasValue()Checks whether the variable has a configuredValue.booleanisLocal()Returns whether this variable is local, e.g., as a parameter of a user-defined function, a variable defined by a let-expression, or an iterator in a container operation.booleanisVisible()Returns whether this variable is visible by the user.voidnotifyCreated()Notifies this variable that it was created.booleannotifyWasAssigned(Value value)Inform the variable independent of its own tracking that we believe that a value was assigned (although we did not due to equal values/performance reasons), in particular after resetting the track throughCommandAssignmentState#compareTo(CommandAssignmentState).booleanremoveDerivedValues()Removes all (nested) values which are in stateAssignmentState.DERIVED, i.e., all values which are propagated bay the reasoner.voidsetHistoryValue(Value value, IAssignmentState state)Changes the value (for incremental buildup) from value history.voidsetValue(Value value, IAssignmentState state)Changes the value (for incremental buildup).voidsetValue(Value value, IAssignmentState state, boolean asAssignment)Changes the value.booleanwasAssigned()Returns whether a value was assigned (correlated, but independent ofIConfigurationElement.getState()).-
Methods inherited from interface net.ssehub.easy.varModel.confModel.IConfigurationElement
freeze, freeze, getConfiguration, getDeclaration, getParent, getState, isNested, setValue, unfreeze, wasCreated
-
Methods inherited from interface net.ssehub.easy.varModel.confModel.IConfigurationVisitable
accept
-
-
-
-
Method Detail
-
getValue
Value getValue()
Returns the current value of thisIDecisionVariable.- Returns:
- the value (may be null)
-
setValue
void setValue(Value value, IAssignmentState state) throws ConfigurationException
Changes the value (for incremental buildup).- Parameters:
value- the value (may be null for incremental buildup)state- the related assignment state- Throws:
ConfigurationException- in case that the types ofIConfigurationElement.getDeclaration()andvaluedo not comply
-
setValue
void setValue(Value value, IAssignmentState state, boolean asAssignment) throws ConfigurationException
Changes the value.- Parameters:
value- the value (may be null for incremental buildup)state- the related assignment stateasAssignment- does this call happen as part of evaluating an IVML assignment operation- Throws:
ConfigurationException- in case that the types ofIConfigurationElement.getDeclaration()andvaluedo not comply
-
setHistoryValue
void setHistoryValue(Value value, IAssignmentState state) throws ConfigurationException
Changes the value (for incremental buildup) from value history.- Parameters:
value- the value (may be null for incremental buildup)state- the related assignment state- Throws:
ConfigurationException- in case that the types ofIConfigurationElement.getDeclaration()andvaluedo not comply
-
getNestedElementsCount
int getNestedElementsCount()
Returns the number of nested elements. The return value should be 0 unless thisIDecisionVariableis a- Returns:
- An integer value greater or equal to 0.
-
getNestedElement
IDecisionVariable getNestedElement(int index)
Returns the element specified byindex. [also req SAP]- Parameters:
index- a 0-based index specifying the element to be returned- Returns:
- the element
- Throws:
java.lang.IndexOutOfBoundsException- ifindex<0 || index>=getNestedElementsCount()
-
getNestedElement
IDecisionVariable getNestedElement(java.lang.String name)
Returns an element specified by its name.- Parameters:
name- the name of the nested element- Returns:
- the nested element (may be null)
-
getAttributesCount
int getAttributesCount()
Returns the number of attributes.- Returns:
- the number of attributes
-
getAttribute
IDecisionVariable getAttribute(int index)
Returns a specific attribute.- Parameters:
index- the index of the attribute- Returns:
- the attribute
- Throws:
java.lang.IndexOutOfBoundsException- ifindex<0 || index>=getAttributesCount()
-
getNestedDepth
int getNestedDepth()
Returns how many parentIDecisionVariables exist for this variable.- Returns:
- 0 if the Configuration is the direct parent of this
IDecisionVariable, otherwise a number greater than 0 indicating how manyIDecisionVariables between theConfigurationand this variable exist.
-
isVisible
boolean isVisible()
Returns whether this variable is visible by the user.- Returns:
- false if the variable is hidden by an interface, true otherwise
-
isLocal
boolean isLocal()
Returns whether this variable is local, e.g., as a parameter of a user-defined function, a variable defined by a let-expression, or an iterator in a container operation.- Returns:
- false if the variable is not local and part of an usual configuration,
trueif the variable is local
-
hasValue
boolean hasValue()
Checks whether the variable has a configuredValue.- Returns:
- true if the variable has a value, false otherwise.
-
hasNullValue
boolean hasNullValue()
Checks whether the variable has aNullValue. Note: this method does not check whether the variable has a value.- Returns:
- true if the variable has a
NullValue, false otherwise.
-
removeDerivedValues
boolean removeDerivedValues()
Removes all (nested) values which are in stateAssignmentState.DERIVED, i.e., all values which are propagated bay the reasoner. This will keep all user assignedAssignmentState.ASSIGNEDand frozenAssignmentState.FROZENvalues.- Returns:
- true if there was a change, false if the variable keeps unchanged.
-
getQualifiedName
java.lang.String getQualifiedName()
Returns the qualified name of the declaration instance. This is build as follows:
<Project name> :: [<Parent name>::]* <Declaration name>- Returns:
- The qualified and unique name of the variable.
-
getResolutionPath
IResolutionPathElement getResolutionPath()
Returns a resolution path for this variable.- Returns:
- the resolution path
-
notifyCreated
void notifyCreated()
Notifies this variable that it was created.
-
enableWasAssignedForIsDefined
boolean enableWasAssignedForIsDefined()
Shall we take the localwasAssigned()overIConfigurationElement.getState()in the implementation of IVML "isDefined".- Returns:
truetakewasAssigned(),falseforIConfigurationElement.getState().
-
notifyWasAssigned
boolean notifyWasAssigned(Value value)
Inform the variable independent of its own tracking that we believe that a value was assigned (although we did not due to equal values/performance reasons), in particular after resetting the track throughCommandAssignmentState#compareTo(CommandAssignmentState).- Parameters:
value- the new value- Returns:
truewhether this variable was defined before,falseelse
-
wasAssigned
boolean wasAssigned()
Returns whether a value was assigned (correlated, but independent ofIConfigurationElement.getState()).- Returns:
trueif a value was assigned,falseelse
-
-