Package net.ssehub.easy.varModel.cst
Class Variable
- java.lang.Object
-
- net.ssehub.easy.varModel.cst.ConstraintSyntaxTree
-
- net.ssehub.easy.varModel.cst.Leaf
-
- net.ssehub.easy.varModel.cst.Variable
-
- All Implemented Interfaces:
IAttributeAccess
- Direct Known Subclasses:
AttributeVariable,ResolvedVariable
public class Variable extends Leaf
Class for a variable value.- Author:
- jaehne, Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private AbstractVariablenestedVariable
-
Constructor Summary
Constructors Constructor Description Variable()Constructor for serialization.Variable(AbstractVariable nestedVariable)The constructor for this class.
-
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)AttributegetAttribute(int index)Returns a specific attribute.intgetAttributesCount()Returns the number of attributes.ConstraintSyntaxTreegetQualifier()Returns the qualifier for accessing the variable, e.g., an expression to be put before.IDecisionVariablegetResolved()Returns the resolved decision variable.AbstractVariablegetVariable()Getter for the nestedVariable.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, getContainedType, getName, getParent
-
-
-
-
Field Detail
-
nestedVariable
private AbstractVariable nestedVariable
-
-
Constructor Detail
-
Variable
Variable()
Constructor for serialization.
-
Variable
public Variable(AbstractVariable nestedVariable)
The constructor for this class.- Parameters:
nestedVariable- The nested variable should be embedded in the current constraint.
-
-
Method Detail
-
getVariable
public AbstractVariable getVariable()
Getter for the nestedVariable.- Returns:
- The nested variable should not be null.
-
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
-
getAttributesCount
public int getAttributesCount()
Description copied from class:ConstraintSyntaxTreeReturns the number of attributes.- Specified by:
getAttributesCountin interfaceIAttributeAccess- Overrides:
getAttributesCountin classConstraintSyntaxTree- Returns:
- the number of attributes
-
getAttribute
public Attribute getAttribute(int index)
Description copied from class:ConstraintSyntaxTreeReturns a specific attribute.- Specified by:
getAttributein interfaceIAttributeAccess- Overrides:
getAttributein classConstraintSyntaxTree- Parameters:
index- the index of the attribute- Returns:
- the attribute
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getQualifier
public ConstraintSyntaxTree getQualifier()
Returns the qualifier for accessing the variable, e.g., an expression to be put before. For usual variables, the qualifier is always null.- Returns:
- the qualifier (may be null)
-
getResolved
public IDecisionVariable getResolved()
Returns the resolved decision variable.- Returns:
- the decision variable (may be null)
-
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.
-
-