Class Attribute

All Implemented Interfaces:
IDatatypeVisitable, IDerivedDatatypeListener, IAttributeAccess, IModelElement
Direct Known Subclasses:
DotAttribute

public class Attribute extends AbstractVariable
Defines an attribute.
Author:
Marcel Lueder, Holger Eichelberger
  • Field Details

  • Constructor Details

    • Attribute

      Attribute()
      Constructor for serialization.
    • Attribute

      public Attribute(String name, IDatatype type, IModelElement parent, IAttributableElement element)
      Constructor for an attribute.
      Parameters:
      name - Name of the attribute
      type - the type of the attribute
      parent - the object, in which this specific one is embedded
      element - the element being attributed
    • Attribute

      public Attribute(String name, IDatatype type, IModelElement parent, IAttributableElement element, Attribute origin)
      Constructor for an attribute.
      Parameters:
      name - Name of the attribute
      type - the type of the attribute
      parent - the object, in which this specific one is embedded
      element - the element being attributed
      origin - in case that this attribute just represents another one (declared on a containing scope, may be null for none)
  • Method Details

    • accept

      public void accept(IModelVisitor visitor)
      Description copied from interface: IModelElement
      Accept method for the visitor.
      Parameters:
      visitor - The visitor, which should process this model element.
    • getElement

      public IAttributableElement getElement()
      Returns the attributed element.
      Returns:
      the attributed element
    • getAttributesCount

      public int getAttributesCount()
      Returns the number of attributes.
      Returns:
      the number of attributes
    • getAttribute

      public Attribute getAttribute(int index)
      Returns a specific attribute.
      Parameters:
      index - the index of the attribute
      Returns:
      the attribute
      Throws:
      IndexOutOfBoundsException - if index<0 || index>=getAttributesCount()
    • getAttribute

      public Attribute getAttribute(String name)
      Returns a specific attribute.
      Parameters:
      name - the name of the attribute
      Returns:
      the attribute (or null if not found)
    • isTemporaryVariable

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

      public boolean isAttribute()
      Returns whether this variable is an attribute.
      Specified by:
      isAttribute in class AbstractVariable
      Returns:
      true if it is an attribute, false else
    • addSeries

      public void addSeries(Attribute attribute)
      Adds an attribute to this as the first one declared in the same statement. Used for output only.
      Parameters:
      attribute - the attribute to be added
    • getSeriesCount

      public int getSeriesCount()
      Returns the number of series entries.
      Returns:
      the number of series entries
    • getSeries

      public Attribute getSeries(int index)
      Returns the specified series element.
      Parameters:
      index - the index of the element to return
      Returns:
      the specified series element
      Throws:
      IndexOutOfBoundsException - if index < 0 || index >=getSeriesCount()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractVariable
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class AbstractVariable
    • toString

      public String toString()
      Returns a textual representation of this element.
      Overrides:
      toString in class ModelElement
      Returns:
      a textual representation
    • isConstant

      public boolean isConstant()
      Description copied from class: AbstractVariable
      Returns whether this variable is a constant.
      Specified by:
      isConstant in class AbstractVariable
      Returns:
      true for constant, false else
    • getOrigin

      public Attribute getOrigin()
      Returns the origin.
      Returns:
      the origin (may be null)
    • isDot

      public boolean isDot()
      Whether this attribute has been specified by ".".
      Returns:
      true for dot, false else