Interface IDecisionVariable
- All Superinterfaces:
IConfigurationElement,IConfigurationVisitable,IValueParent
- All Known Implementing Classes:
BasisVariable,CompoundVariable,ContainerVariable,DecisionVariable,LocalDecisionVariable,SequenceVariable,SetVariable,StructuredVariable
public interface IDecisionVariable
extends IConfigurationElement, IConfigurationVisitable, IValueParent
Interface for configurable
DecisionVariable.
Contrary to IConfigurationElement, this interface is only for elements of the Configuration,
not the Configuration itself.- Author:
- El-Sharkawy
-
Method Summary
Modifier and TypeMethodDescriptionbooleanShall we take the localwasAssigned()overIConfigurationElement.getState()in the implementation of IVML "isDefined".getAttribute(int index) Returns a specific attribute.intReturns the number of attributes.intReturns how many parentIDecisionVariables exist for this variable.getNestedElement(int index) Returns the element specified byindex.getNestedElement(String name) Returns an element specified by its name.intReturns the number of nested elements.Returns the qualified name of the declaration instance.Returns a resolution path for this variable.getValue()Returns the current value of thisIDecisionVariable.booleanChecks 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.booleanReturns whether this variable is visible by the user.voidNotifies 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 throughEnum.compareTo(CommandAssignmentState).booleanRemoves 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.booleanReturns 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, wasCreatedMethods inherited from interface net.ssehub.easy.varModel.confModel.IConfigurationVisitable
accept
-
Method Details
-
getValue
Value getValue()Returns the current value of thisIDecisionVariable.- Returns:
- the value (may be null)
-
setValue
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
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
Returns the element specified byindex. [also req SAP]- Parameters:
index- a 0-based index specifying the element to be returned- Returns:
- the element
- Throws:
IndexOutOfBoundsException- ifindex<0 || index>=getNestedElementsCount()
-
getNestedElement
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
Returns a specific attribute.- Parameters:
index- the index of the attribute- Returns:
- the attribute
- Throws:
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:
falseif the variable is hidden by an interface,trueotherwise
-
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:
falseif 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:
trueif the variable has a value,falseotherwise.
-
hasNullValue
boolean hasNullValue()Checks whether the variable has aNullValue. Note: this method does not check whether the variable has a value.- Returns:
trueif the variable has aNullValue,falseotherwise.
-
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:
trueif there was a change,falseif the variable keeps unchanged.
-
getQualifiedName
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
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 throughEnum.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
-