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 Object implements IAttributeAccess
Class to show the syntax of an Constraint.
Author:
Heiko Beck, Holger Eichelberger
  • Constructor Details

    • ConstraintSyntaxTree

      public ConstraintSyntaxTree()
  • Method Details

    • 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:
      getAttributesCount in interface IAttributeAccess
      Returns:
      the number of attributes
    • getAttribute

      public Attribute getAttribute(int index)
      Returns a specific attribute.
      Specified by:
      getAttribute in interface IAttributeAccess
      Parameters:
      index - the index of the attribute
      Returns:
      the attribute
      Throws:
      IndexOutOfBoundsException - if index<0 || index>=getAttributesCount()
    • getAttribute

      public Attribute getAttribute(String name)
      Returns a specific attribute.
      Specified by:
      getAttribute in interface IAttributeAccess
      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:
      getParent in interface IAttributeAccess
      Returns:
      the parent model element (may be null)
    • isSemanticallyEqual

      public boolean isSemanticallyEqual(ConstraintSyntaxTree otherTree)
      Checks whether this ConstraintSyntaxTree is semantically equal to another ConstraintSyntaxTree. 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 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