Package net.ssehub.easy.varModel.model
Class Attribute
- java.lang.Object
-
- net.ssehub.easy.varModel.model.ModelElement
-
- net.ssehub.easy.varModel.model.ContainableModelElement
-
- net.ssehub.easy.varModel.model.AbstractVariable
-
- net.ssehub.easy.varModel.model.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
-
-
Constructor Summary
Constructors Constructor Description Attribute()Constructor for serialization.Attribute(java.lang.String name, IDatatype type, IModelElement parent, IAttributableElement element)Constructor for an attribute.Attribute(java.lang.String name, IDatatype type, IModelElement parent, IAttributableElement element, Attribute origin)Constructor for an attribute.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(IModelVisitor visitor)Accept method for the visitor.voidaddSeries(Attribute attribute)Adds an attribute to this as the first one declared in the same statement.booleanequals(java.lang.Object obj)AttributegetAttribute(int index)Returns a specific attribute.AttributegetAttribute(java.lang.String name)Returns a specific attribute.intgetAttributesCount()Returns the number of attributes.IAttributableElementgetElement()Returns the attributed element.AttributegetOrigin()Returns the origin.AttributegetSeries(int index)Returns the specified series element.intgetSeriesCount()Returns the number of series entries.inthashCode()booleanisAttribute()Returns whether this variable is an attribute.booleanisConstant()Returns whether this variable is a constant.booleanisDot()Whether this attribute has been specified by ".".booleanisTemporaryVariable()Returns whether this decision variable declaration is used as a temporary variable (in constraints, i.e.java.lang.StringtoString()Returns a textual representation of this element.-
Methods inherited from class net.ssehub.easy.varModel.model.AbstractVariable
constraintsChanged, getDefaultValue, getType, isSame, setValue, setValue, setValue
-
Methods inherited from class net.ssehub.easy.varModel.model.ContainableModelElement
accept, getNameSpace, getParent, getProject, getQualifiedName, getTopLevelParent, isTopLevel, setParent
-
Methods inherited from class net.ssehub.easy.varModel.model.ModelElement
findAttribute, getComment, getName, getUniqueName, isTransparent, propagateAttribute, setComment, setName
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.ssehub.easy.varModel.model.IAttributeAccess
getParent
-
-
-
-
Field Detail
-
element
private IAttributableElement element
-
series
private java.util.List<Attribute> series
-
origin
private Attribute origin
-
-
Constructor Detail
-
Attribute
Attribute()
Constructor for serialization.
-
Attribute
public Attribute(java.lang.String name, IDatatype type, IModelElement parent, IAttributableElement element)Constructor for an attribute.- Parameters:
name- Name of the attributetype- the type of the attributeparent- the object, in which this specific one is embeddedelement- the element being attributed
-
Attribute
public Attribute(java.lang.String name, IDatatype type, IModelElement parent, IAttributableElement element, Attribute origin)Constructor for an attribute.- Parameters:
name- Name of the attributetype- the type of the attributeparent- the object, in which this specific one is embeddedelement- the element being attributedorigin- in case that this attribute just represents another one (declared on a containing scope, may be null for none)
-
-
Method Detail
-
accept
public void accept(IModelVisitor visitor)
Description copied from interface:IModelElementAccept 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:
java.lang.IndexOutOfBoundsException- ifindex<0 || index>=getAttributesCount()
-
getAttribute
public Attribute getAttribute(java.lang.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:AbstractVariableReturns whether this decision variable declaration is used as a temporary variable (in constraints, i.e. the parent is a constraint).- Specified by:
isTemporaryVariablein classAbstractVariable- Returns:
trueif it is a temporary variable,falseif it is a defined variable in the model
-
isAttribute
public boolean isAttribute()
Returns whether this variable is an attribute.- Specified by:
isAttributein classAbstractVariable- Returns:
trueif it is an attribute,falseelse
-
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:
java.lang.IndexOutOfBoundsException- ifindex < 0 || index >=getSeriesCount()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractVariable
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classAbstractVariable
-
toString
public java.lang.String toString()
Returns a textual representation of this element.- Overrides:
toStringin classModelElement- Returns:
- a textual representation
-
isConstant
public boolean isConstant()
Description copied from class:AbstractVariableReturns whether this variable is a constant.- Specified by:
isConstantin classAbstractVariable- Returns:
truefor constant,falseelse
-
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:
truefor dot,falseelse
-
-