Package net.ssehub.easy.varModel.cst
Class CompoundAccess
- java.lang.Object
-
- net.ssehub.easy.varModel.cst.ConstraintSyntaxTree
-
- net.ssehub.easy.varModel.cst.CompoundAccess
-
- All Implemented Interfaces:
IAttributeAccess
public class CompoundAccess extends ConstraintSyntaxTree
Represents an expression which accesses a compound slot where the compound is specified as aConstraintSyntaxTree.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private ConstraintSyntaxTreecompoundExpressionprivate AbstractVariableslotprivate java.lang.StringslotName
-
Constructor Summary
Constructors Constructor Description CompoundAccess()Constructor for serialization.CompoundAccess(ConstraintSyntaxTree compoundExpression, java.lang.String slotName)Creates a compound access 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)ConstraintSyntaxTreegetCompoundExpression()The expression denoting the compound to access.AbstractVariablegetResolvedSlot()Returns the resolved compound slot.java.lang.StringgetSlotName()Returns the name of the slot.IDatatypegetStaticType()Returns the static type in case that this compound access is a static access.inthashCode()IDatatypeinferDatatype()Infers the datatype of the subtree represented by this object.private DecisionVariableDeclarationsearchSlot(Compound comp, java.lang.String slotName)Searches for a slot incompor its refined compounds.-
Methods inherited from class net.ssehub.easy.varModel.cst.ConstraintSyntaxTree
getAttribute, getAttribute, getAttributesCount, getContainedType, getName, getParent, isSemanticallyEqual
-
-
-
-
Field Detail
-
compoundExpression
private ConstraintSyntaxTree compoundExpression
-
slotName
private java.lang.String slotName
-
slot
private AbstractVariable slot
-
-
Constructor Detail
-
CompoundAccess
CompoundAccess()
Constructor for serialization.
-
CompoundAccess
public CompoundAccess(ConstraintSyntaxTree compoundExpression, java.lang.String slotName)
Creates a compound access node.- Parameters:
compoundExpression- an expression denoting a compoundslotName- the name of the accessed slot
-
-
Method Detail
-
searchSlot
private DecisionVariableDeclaration searchSlot(Compound comp, java.lang.String slotName)
Searches for a slot incompor its refined compounds.- Parameters:
comp- the compound to searchslotName- the name to search- Returns:
- the containing compound or null
-
getStaticType
public IDatatype getStaticType() throws CSTSemanticException
Returns the static type in case that this compound access is a static access.- Returns:
- the static type or null
- Throws:
CSTSemanticException- in case of semantic errors
-
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.
-
getCompoundExpression
public ConstraintSyntaxTree getCompoundExpression()
The expression denoting the compound to access.- Returns:
- the compound expression
-
getSlotName
public java.lang.String getSlotName()
Returns the name of the slot.- Returns:
- the name of the slot
-
getResolvedSlot
public AbstractVariable getResolvedSlot()
Returns the resolved compound slot. The result is only valid ifinferDatatype()was called before this operation.- Returns:
- the resolved slot, null if the slot cannot
be resolved or
inferDatatype()was not called before
-
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
-
-