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 Details

    • getValue

      Value getValue()
      Returns the current value of this IDecisionVariable.
      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 of IConfigurationElement.getDeclaration() and value do 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 state
      asAssignment - does this call happen as part of evaluating an IVML assignment operation
      Throws:
      ConfigurationException - in case that the types of IConfigurationElement.getDeclaration() and value do 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 of IConfigurationElement.getDeclaration() and value do not comply
    • getNestedElementsCount

      int getNestedElementsCount()
      Returns the number of nested elements. The return value should be 0 unless this IDecisionVariable is a
      Returns:
      An integer value greater or equal to 0.
    • getNestedElement

      IDecisionVariable getNestedElement(int index)
      Returns the element specified by index. [also req SAP]
      Parameters:
      index - a 0-based index specifying the element to be returned
      Returns:
      the element
      Throws:
      IndexOutOfBoundsException - if index<0 || index>=getNestedElementsCount()
    • getNestedElement

      IDecisionVariable getNestedElement(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:
      IndexOutOfBoundsException - if index<0 || index>=getAttributesCount()
    • getNestedDepth

      int getNestedDepth()
      Returns how many parent IDecisionVariables exist for this variable.
      Returns:
      0 if the Configuration is the direct parent of this IDecisionVariable, otherwise a number greater than 0 indicating how many IDecisionVariables between the Configuration and 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, true if the variable is local
    • hasValue

      boolean hasValue()
      Checks whether the variable has a configured Value.
      Returns:
      true if the variable has a value, false otherwise.
    • hasNullValue

      boolean hasNullValue()
      Checks whether the variable has a NullValue. 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 state AssignmentState.DERIVED, i.e., all values which are propagated bay the reasoner. This will keep all user assigned AssignmentState.ASSIGNED and frozen AssignmentState.FROZEN values.
      Returns:
      true if there was a change, false if the variable keeps unchanged.
    • getQualifiedName

      String getQualifiedName()
      Returns the qualified name of the declaration instance. This is build as follows:
      &lt;Project name&gt; :: [&lt;Parent name&gt;::]* &lt;Declaration name&gt;
      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 local wasAssigned() over IConfigurationElement.getState() in the implementation of IVML "isDefined".
      Returns:
      true take wasAssigned(), false for IConfigurationElement.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 through Enum.compareTo(CommandAssignmentState).
      Parameters:
      value - the new value
      Returns:
      true whether this variable was defined before, false else
    • wasAssigned

      boolean wasAssigned()
      Returns whether a value was assigned (correlated, but independent of IConfigurationElement.getState()).
      Returns:
      true if a value was assigned, false else