Class CollectionElementVariable
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.cstEvaluation.CollectionElementVariable
- All Implemented Interfaces:
ICollectionElementVariable,IDatatypeVisitable,IDerivedDatatypeListener,IAttributeAccess,IModelElement
A temporary variable representing a value of a container. By design decision, container
do not have contained decision variables. Anyway, references to container variables can
be defined and are resolved via this temporary variable. For resolving this variable
for a specific configuration, this class is equipped with a resolution path for deferred
variable resolution.
- Author:
- Holger Eichelberger
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AbstractVariableprivate intprivate IResolutionPathElement -
Constructor Summary
ConstructorsConstructorDescriptionCollectionElementVariable(AbstractVariable base, IDatatype type, IResolutionPathElement path, int index) Creates a collection element variable. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(IModelVisitor visitor) Accept method for the visitor.getAttribute(int index) Returns a specific attribute.getAttribute(String name) Returns a specific (declared) attribute.intReturns the number of (declared) attributes.The base variable representing the collection.intgetIndex()The index of the element in the collection, i.e., the nested element.booleanReturns whether this variable is an attribute.booleanReturns whether this variable is a constant.booleanReturns whether this decision variable declaration is used as a temporary variable (in constraints, i.e.resolve(IConfiguration config) Resolves the element variable to a decision variable.Methods inherited from class net.ssehub.easy.varModel.model.AbstractVariable
constraintsChanged, equals, getDefaultValue, getType, hashCode, 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, setName, toStringMethods 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
-
base
-
index
private int index -
path
-
-
Constructor Details
-
CollectionElementVariable
CollectionElementVariable(AbstractVariable base, IDatatype type, IResolutionPathElement path, int index) Creates a collection element variable.- Parameters:
base- the base the collection variabletype- the contained typepath- the path to resolvebasein a configurationindex- the index withinbase
-
-
Method Details
-
getAttributesCount
public int getAttributesCount()Description copied from interface:IAttributeAccessReturns the number of (declared) attributes.- Specified by:
getAttributesCountin interfaceIAttributeAccess- Returns:
- the number of attributes
-
getAttribute
Description copied from interface:IAttributeAccessReturns a specific (declared) attribute.- Specified by:
getAttributein interfaceIAttributeAccess- Parameters:
name- the name of the attribute- Returns:
- the attribute (or null if not found)
-
getAttribute
Description copied from interface:IAttributeAccessReturns a specific attribute.- Specified by:
getAttributein interfaceIAttributeAccess- Parameters:
index- the index of the attribute- Returns:
- the attribute
-
accept
Description copied from interface:IModelElementAccept method for the visitor.- Specified by:
acceptin interfaceIModelElement- Parameters:
visitor- The visitor, which should process this model element.
-
getIndex
public int getIndex()Description copied from interface:ICollectionElementVariableThe index of the element in the collection, i.e., the nested element.- Specified by:
getIndexin interfaceICollectionElementVariable- Returns:
- the index
-
getBaseVariable
Description copied from interface:ICollectionElementVariableThe base variable representing the collection.- Specified by:
getBaseVariablein interfaceICollectionElementVariable- Returns:
- the collection base variable
-
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()Description copied from class:AbstractVariableReturns whether this variable is an attribute.- Specified by:
isAttributein classAbstractVariable- Returns:
trueif it is an attribute,falseelse
-
resolve
Description copied from interface:ICollectionElementVariableResolves the element variable to a decision variable.- Specified by:
resolvein interfaceICollectionElementVariable- Parameters:
config- the configuration to resolve on- Returns:
- the resolved decision variable (may be null if not resolvable)
-
isConstant
public boolean isConstant()Description copied from class:AbstractVariableReturns whether this variable is a constant.- Specified by:
isConstantin classAbstractVariable- Returns:
truefor constant,falseelse
-