Package net.ssehub.easy.varModel.cst
Class AttributeVariable
- java.lang.Object
-
- net.ssehub.easy.varModel.cst.ConstraintSyntaxTree
-
- net.ssehub.easy.varModel.cst.Leaf
-
- net.ssehub.easy.varModel.cst.Variable
-
- net.ssehub.easy.varModel.cst.AttributeVariable
-
- All Implemented Interfaces:
IAttributeAccess
public class AttributeVariable extends Variable
A variable which represents an attribute. However, access to an attribute may be qualified, e.g. via aCompoundAccess, i.e.,qualifier.attributewhereby qualifier may even bec.a.attributeof unlimited nesting. However, the attribute shall point to the original definition of the attribute variable. This class is a (polymorphic) subclass ofVariableas it just adds an attribute (and helps saving memory in case that the qualifying attribute is not needed).- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private ConstraintSyntaxTreequalifier
-
Constructor Summary
Constructors Constructor Description AttributeVariable()Constructor for serialization.AttributeVariable(ConstraintSyntaxTree qualifier, Attribute attribute)Creates an attribute variable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(IConstraintTreeVisitor visitor)Visiting method for the visitor.booleanequals(java.lang.Object obj)ConstraintSyntaxTreegetQualifier()Returns the qualifier for accessing the variable, e.g., an expression to be put before.inthashCode()IDatatypeinferDatatype()Infers the datatype of the subtree represented by this object.java.lang.StringtoString()-
Methods inherited from class net.ssehub.easy.varModel.cst.Variable
getAttribute, getAttributesCount, getResolved, getVariable, isSemanticallyEqual
-
Methods inherited from class net.ssehub.easy.varModel.cst.ConstraintSyntaxTree
getAttribute, getContainedType, getName, getParent
-
-
-
-
Field Detail
-
qualifier
private ConstraintSyntaxTree qualifier
-
-
Constructor Detail
-
AttributeVariable
AttributeVariable()
Constructor for serialization.
-
AttributeVariable
public AttributeVariable(ConstraintSyntaxTree qualifier, Attribute attribute)
Creates an attribute variable.- Parameters:
qualifier- an optional expression required to uniquely address the specific variable theattributeis referring to (may be null)attribute- the attribute (as variable)
-
-
Method Detail
-
getQualifier
public ConstraintSyntaxTree getQualifier()
Returns the qualifier for accessing the variable, e.g., an expression to be put before.- Overrides:
getQualifierin classVariable- Returns:
- the qualifier (may be null)
-
accept
public void accept(IConstraintTreeVisitor visitor)
Description copied from class:ConstraintSyntaxTreeVisiting method for the visitor.
This method is used for saving this model element.
-
inferDatatype
public IDatatype inferDatatype() throws CSTSemanticException
Description copied from class:ConstraintSyntaxTreeInfers the datatype of the subtree represented by this object.- Overrides:
inferDatatypein classVariable- Returns:
- the data type
- Throws:
CSTSemanticException- Will be thrown if parameters of (sub-) trees do not fit together.
-
-