Class AbstractVariable

    • Constructor Detail

      • AbstractVariable

        public AbstractVariable​(java.lang.String name,
                                IDatatype type,
                                IModelElement parent)
        Constructor for decision variable declaration.
        Parameters:
        name - Name of the decision variable declaration
        type - type of the new VariableDeclaration
        parent - the object, in which this specific one is embedded
      • AbstractVariable

        public AbstractVariable​(java.lang.String name,
                                IDatatype type,
                                Value defaultValue,
                                IModelElement parent)
        Constructor for explicit variable creation.
        Parameters:
        name - Name of the decision variable declaration
        type - type of the new VariableDeclaration
        defaultValue - the default value (may be null)
        parent - the object, in which this specific one is embedded
    • Method Detail

      • setValue

        public void setValue​(java.lang.String value)
                      throws ValueDoesNotMatchTypeException
        Defines the default value. Note that this method provides exactly one value, not multiple as required in case of containers or compounds.
        Parameters:
        value - the default value.
        Throws:
        ValueDoesNotMatchTypeException - if one of the default values do not comply to the respective types
      • setValue

        public void setValue​(java.lang.Object... values)
                      throws ValueDoesNotMatchTypeException
        Defines (possible multiple) default value(s).
        Parameters:
        values - the (possible) multiple values
        Throws:
        ValueDoesNotMatchTypeException - if one of the default values do not comply to the respective types
      • getDefaultValue

        public ConstraintSyntaxTree getDefaultValue()
        Getter for the value.
        Returns:
        the value
      • getType

        public IDatatype getType()
        Returns the type of this variable.
        Returns:
        the type of this variable
      • isSame

        public boolean isSame​(AbstractVariable var)
        Returns whether two variables are considered as being the same (same name/type). Please consider that this method does not check for the scope, e.g., whether they are in the same compound.
        Parameters:
        var - the variable to check for
        Returns:
        true if they are equal, false else
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • isTemporaryVariable

        public abstract boolean isTemporaryVariable()
        Returns whether this decision variable declaration is used as a temporary variable (in constraints, i.e. the parent is a constraint).
        Returns:
        true if it is a temporary variable, false if it is a defined variable in the model
      • isAttribute

        public abstract boolean isAttribute()
        Returns whether this variable is an attribute.
        Returns:
        true if it is an attribute, false else
      • isConstant

        public abstract boolean isConstant()
        Returns whether this variable is a constant.
        Returns:
        true for constant, false else