Package net.ssehub.easy.varModel.cst
Class ConstraintSyntaxTree
java.lang.Object
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree
- All Implemented Interfaces:
IAttributeAccess
- Direct Known Subclasses:
BlockExpression,Comment,CompoundAccess,CompoundInitializer,ContainerInitializer,ContainerOperationCall,DeferInitExpression,IfThen,Leaf,Let,MultiAndExpression,NamedArgument,OCLFeatureCall,Parenthesis,UnresolvedExpression
Class to show the syntax of an Constraint.
- Author:
- Heiko Beck, Holger Eichelberger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidaccept(IConstraintTreeVisitor visitor) Visiting method for the visitor.getAttribute(int index) Returns a specific attribute.getAttribute(String name) Returns a specific attribute.intReturns the number of attributes.Returns the data type explicitly contained in this syntax tree.getName()Returns the name of the constraint syntax tree (in case if it is used as a named argument).Returns the parent model element.abstract IDatatypeInfers the datatype of the subtree represented by this object.booleanisSemanticallyEqual(ConstraintSyntaxTree otherTree) Checks whether thisConstraintSyntaxTreeis semantically equal to anotherConstraintSyntaxTree.
-
Constructor Details
-
ConstraintSyntaxTree
public ConstraintSyntaxTree()
-
-
Method Details
-
accept
Visiting method for the visitor.
This method is used for saving this model element.- Parameters:
visitor- The visitor, which should save this model element.
-
inferDatatype
Infers the datatype of the subtree represented by this object.- Returns:
- the data type
- Throws:
CSTSemanticException- Will be thrown if parameters of (sub-) trees do not fit together.
-
getContainedType
Returns the data type explicitly contained in this syntax tree. This is typically a constant value which contains a meta value, i.e. a type expression.- Returns:
- the contained type or null if there is none
-
getAttributesCount
public int getAttributesCount()Returns the number of attributes.- Specified by:
getAttributesCountin interfaceIAttributeAccess- Returns:
- the number of attributes
-
getAttribute
Returns a specific attribute.- Specified by:
getAttributein interfaceIAttributeAccess- Parameters:
index- the index of the attribute- Returns:
- the attribute
- Throws:
IndexOutOfBoundsException- ifindex<0 || index>=getAttributesCount()
-
getAttribute
Returns a specific attribute.- Specified by:
getAttributein interfaceIAttributeAccess- Parameters:
name- the name of the attribute- Returns:
- the attribute (or null if not found)
-
getParent
Returns the parent model element.- Specified by:
getParentin interfaceIAttributeAccess- Returns:
- the parent model element (may be null)
-
isSemanticallyEqual
Checks whether thisConstraintSyntaxTreeis semantically equal to anotherConstraintSyntaxTree. Attention:This method is not fully supported by all operations and sub classes.- Parameters:
otherTree- Another cst to check whether it is semantically equal to this cst.- Returns:
trueif both trees are semantically equal,falseotherwise.
-
getName
Returns the name of the constraint syntax tree (in case if it is used as a named argument).- Returns:
- the name, may be null for none
-