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
Defines an attribute.
- Author:
- Marcel Lueder, Holger Eichelberger
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for serialization.Attribute(String name, IDatatype type, IModelElement parent, IAttributableElement element) Constructor for an attribute.Attribute(String name, IDatatype type, IModelElement parent, IAttributableElement element, Attribute origin) Constructor for an attribute. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(IModelVisitor visitor) Accept method for the visitor.voidAdds an attribute to this as the first one declared in the same statement.booleangetAttribute(int index) Returns a specific attribute.getAttribute(String name) Returns a specific attribute.intReturns the number of attributes.Returns the attributed element.Returns the origin.getSeries(int index) Returns the specified series element.intReturns the number of series entries.inthashCode()booleanReturns whether this variable is an attribute.booleanReturns whether this variable is a constant.booleanisDot()Whether this attribute has been specified by ".".booleanReturns whether this decision variable declaration is used as a temporary variable (in constraints, i.e.toString()Returns a textual representation of this element.Methods inherited from class net.ssehub.easy.varModel.model.AbstractVariable
constraintsChanged, getDefaultValue, getType, isSame, setValue, setValue, setValueMethods inherited from class net.ssehub.easy.varModel.model.ContainableModelElement
accept, getNameSpace, getParent, getProject, getQualifiedName, getTopLevelParent, isTopLevel, setParentMethods inherited from class net.ssehub.easy.varModel.model.ModelElement
findAttribute, getComment, getName, getUniqueName, isTransparent, propagateAttribute, setComment, setNameMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.ssehub.easy.varModel.model.IAttributeAccess
getParent
-
Field Details
-
element
-
series
-
origin
-
-
Constructor Details
-
Attribute
Attribute()Constructor for serialization. -
Attribute
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(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 Details
-
accept
Description copied from interface:IModelElementAccept method for the visitor.- Parameters:
visitor- The visitor, which should process this model element.
-
getElement
Returns the attributed element.- Returns:
- the attributed element
-
getAttributesCount
public 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()
-
getAttribute
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
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
Returns the specified series element.- Parameters:
index- the index of the element to return- Returns:
- the specified series element
- Throws:
IndexOutOfBoundsException- ifindex < 0 || index >=getSeriesCount()
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractVariable
-
equals
- Overrides:
equalsin classAbstractVariable
-
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
Returns the origin.- Returns:
- the origin (may be null)
-
isDot
public boolean isDot()Whether this attribute has been specified by ".".- Returns:
truefor dot,falseelse
-