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
public abstract class ConstraintSyntaxTree extends java.lang.Object implements IAttributeAccess
Class to show the syntax of an Constraint.- Author:
- Heiko Beck, Holger Eichelberger
-
-
Constructor Summary
Constructors Constructor Description ConstraintSyntaxTree()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidaccept(IConstraintTreeVisitor visitor)Visiting method for the visitor.AttributegetAttribute(int index)Returns a specific attribute.AttributegetAttribute(java.lang.String name)Returns a specific attribute.intgetAttributesCount()Returns the number of attributes.IDatatypegetContainedType()Returns the data type explicitly contained in this syntax tree.java.lang.StringgetName()Returns the name of the constraint syntax tree (in case if it is used as a named argument).IModelElementgetParent()Returns the parent model element.abstract IDatatypeinferDatatype()Infers the datatype of the subtree represented by this object.booleanisSemanticallyEqual(ConstraintSyntaxTree otherTree)Checks whether thisConstraintSyntaxTreeis semantically equal to anotherConstraintSyntaxTree.
-
-
-
Method Detail
-
accept
public abstract void accept(IConstraintTreeVisitor visitor)
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
public abstract IDatatype inferDatatype() throws CSTSemanticException
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
public IDatatype 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
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)
-
getParent
public IModelElement getParent()
Returns the parent model element.- Specified by:
getParentin interfaceIAttributeAccess- Returns:
- the parent model element (may be null)
-
isSemanticallyEqual
public boolean isSemanticallyEqual(ConstraintSyntaxTree otherTree)
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:
- true if both trees are semantically equal, false otherwise.
-
getName
public java.lang.String 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
-
-