Package net.ssehub.easy.varModel.cst
Class Parenthesis
- java.lang.Object
-
- net.ssehub.easy.varModel.cst.ConstraintSyntaxTree
-
- net.ssehub.easy.varModel.cst.Parenthesis
-
- All Implemented Interfaces:
IAttributeAccess
public class Parenthesis extends ConstraintSyntaxTree
Represents a parenthesis. The value of a parenthesis is just the value of the contained expression. This class is used to represent explicit sub expressions.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private ConstraintSyntaxTreeexprStores the expression in the parenthesis.
-
Constructor Summary
Constructors Constructor Description Parenthesis()Constructor for serialization.Parenthesis(ConstraintSyntaxTree expr)Creates a new parenthesis node.
-
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)ConstraintSyntaxTreegetExpr()Returns the nested expression.inthashCode()IDatatypeinferDatatype()Infers the datatype of the subtree represented by this object.booleanisSemanticallyEqual(ConstraintSyntaxTree otherTree)Checks whether thisConstraintSyntaxTreeis semantically equal to anotherConstraintSyntaxTree.java.lang.StringtoString()-
Methods inherited from class net.ssehub.easy.varModel.cst.ConstraintSyntaxTree
getAttribute, getAttribute, getAttributesCount, getContainedType, getName, getParent
-
-
-
-
Field Detail
-
expr
private ConstraintSyntaxTree expr
Stores the expression in the parenthesis.
-
-
Constructor Detail
-
Parenthesis
Parenthesis()
Constructor for serialization.
-
Parenthesis
public Parenthesis(ConstraintSyntaxTree expr)
Creates a new parenthesis node.- Parameters:
expr- the nested expression
-
-
Method Detail
-
getExpr
public ConstraintSyntaxTree getExpr()
Returns the nested expression.- Returns:
- the nested expression
-
inferDatatype
public IDatatype inferDatatype() throws CSTSemanticException
Description copied from class:ConstraintSyntaxTreeInfers the datatype of the subtree represented by this object.- Specified by:
inferDatatypein classConstraintSyntaxTree- Returns:
- the data type
- Throws:
CSTSemanticException- Will be thrown if parameters of (sub-) trees do not fit together.
-
accept
public void accept(IConstraintTreeVisitor visitor)
Description copied from class:ConstraintSyntaxTreeVisiting method for the visitor.
This method is used for saving this model element.- Specified by:
acceptin classConstraintSyntaxTree- Parameters:
visitor- The visitor, which should save this model element.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isSemanticallyEqual
public boolean isSemanticallyEqual(ConstraintSyntaxTree otherTree)
Description copied from class:ConstraintSyntaxTreeChecks whether thisConstraintSyntaxTreeis semantically equal to anotherConstraintSyntaxTree. Attention:This method is not fully supported by all operations and sub classes.- Overrides:
isSemanticallyEqualin classConstraintSyntaxTree- Parameters:
otherTree- Another cst to check whether it is semantically equal to this cst.- Returns:
- true if both trees are semantically equal, false otherwise.
-
-