Package net.ssehub.easy.varModel.model
Class DecisionVariableDeclaration
- 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.DecisionVariableDeclaration
-
- All Implemented Interfaces:
IVariable,IDatatypeVisitable,IDerivedDatatypeListener,IAttributableElement,IAttributeAccess,IFreezable,IModelElement
- Direct Known Subclasses:
ConstantDecisionVariableDeclaration,ExplicitTypeVariableDeclaration,ProjectDecisionVariableDeclaration
public class DecisionVariableDeclaration extends AbstractVariable implements IFreezable, IAttributableElement, IVariable
Implements a decision variable.- Author:
- Marcel Lueder, Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<Attribute>attributes
-
Constructor Summary
Constructors Constructor Description DecisionVariableDeclaration()Constructor for serialization.DecisionVariableDeclaration(java.lang.String name, IDatatype type, IModelElement parent)Constructor for decision variable declaration.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(IModelVisitor visitor)Accept method for the visitor.private booleanaddAttribute(Attribute attribute)Adds an attribute.booleanattribute(Attribute attribute)Attributes this element.AttributegetAttribute(int index)Returns a specific attribute.AttributegetAttribute(java.lang.String name)Returns a specific attribute.intgetAttributesCount()Returns the number of attributes.booleanisAttribute()Returns whether this variable is an attribute.booleanisConstant()Returns whether this variable is a constant.booleanisDeclaratorTypeExplicit()In case that this instance is used as a (set operation) declarator, was the type declared explicitly in the model?booleanisTemporaryDeclarator()Returns whether this variable is a temporary declarator, i.e., a temporary variable create to quality an unqualified container iterator.booleanisTemporaryVariable()Returns whether this decision variable declaration is used as a temporary variable (in constraints, i.e.private static EASyLoggerFactory.EASyLoggerlogger()Logger.booleanpropagateAttribute(Attribute attribute)Propagates an attribute application from the parent to this element or contained elements.-
Methods inherited from class net.ssehub.easy.varModel.model.AbstractVariable
constraintsChanged, equals, getDefaultValue, getType, hashCode, 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, setComment, setName, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.ssehub.easy.varModel.model.IAttributableElement
getName, getQualifiedName
-
Methods inherited from interface net.ssehub.easy.varModel.model.IFreezable
getName, getParent, getType
-
-
-
-
Field Detail
-
attributes
private java.util.List<Attribute> attributes
-
-
Constructor Detail
-
DecisionVariableDeclaration
DecisionVariableDeclaration()
Constructor for serialization.
-
DecisionVariableDeclaration
public DecisionVariableDeclaration(java.lang.String name, IDatatype type, IModelElement parent)Constructor for decision variable declaration.- Parameters:
name- Name of the decision variable declarationtype- type of the new VariableDeclarationparent- the object, in which this specific one is embedded
-
-
Method Detail
-
accept
public void accept(IModelVisitor visitor)
Description copied from interface:IFreezableAccept method for the visitor.- Specified by:
acceptin interfaceIFreezable- Specified by:
acceptin interfaceIModelElement- Parameters:
visitor- The visitor, which should process this model element.
-
addAttribute
private boolean addAttribute(Attribute attribute)
Adds an attribute.- Parameters:
attribute- the attribute to be added- Returns:
trueif the operation was successful,falseif the element is about being attributed multiple times with the same attribute
-
attribute
public boolean attribute(Attribute attribute)
Attributes this element.- Specified by:
attributein interfaceIAttributableElement- Parameters:
attribute- the attribute to be added- Returns:
trueif the operation was successful,falseif the element is about being attributed multiple times with the same attribute
-
getAttributesCount
public int getAttributesCount()
Returns the number of attributes.- Specified by:
getAttributesCountin interfaceIAttributeAccess- Returns:
- the number of attributes
-
getAttribute
public Attribute getAttribute(int index)
Returns a specific attribute.- Specified by:
getAttributein interfaceIAttributeAccess- 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.- Specified by:
getAttributein interfaceIAttributeAccess- 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
-
isTemporaryDeclarator
public boolean isTemporaryDeclarator()
Returns whether this variable is a temporary declarator, i.e., a temporary variable create to quality an unqualified container iterator.- Returns:
truefor temporary,falseelse
-
isAttribute
public boolean isAttribute()
Returns whether this variable is an attribute.- Specified by:
isAttributein classAbstractVariable- Returns:
trueif it is an attribute,falseelse
-
propagateAttribute
public boolean propagateAttribute(Attribute attribute)
Description copied from interface:IModelElementPropagates an attribute application from the parent to this element or contained elements. This may imply the creation of clones of the givenattribute.- Specified by:
propagateAttributein interfaceIModelElement- Overrides:
propagateAttributein classModelElement- Parameters:
attribute- the attribute to be propagated- Returns:
trueif the operation was successful,falseif the element is about being attributed multiple times with the same attribute
-
logger
private static EASyLoggerFactory.EASyLogger logger()
Logger.- Returns:
- logger
-
isDeclaratorTypeExplicit
public boolean isDeclaratorTypeExplicit()
In case that this instance is used as a (set operation) declarator, was the type declared explicitly in the model?- Returns:
falseif not explicit,trueif explicit
-
isConstant
public boolean isConstant()
Description copied from class:AbstractVariableReturns whether this variable is a constant.- Specified by:
isConstantin classAbstractVariable- Returns:
truefor constant,falseelse
-
-