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 a ConstraintSyntaxTree.
Author:
Holger Eichelberger
  • Field Details

  • Constructor Details

    • CompoundAccess

      CompoundAccess()
      Constructor for serialization.
    • CompoundAccess

      public CompoundAccess(ConstraintSyntaxTree compoundExpression, String slotName)
      Creates a compound access node.
      Parameters:
      compoundExpression - an expression denoting a compound
      slotName - the name of the accessed slot
  • Method Details

    • searchSlot

      private DecisionVariableDeclaration searchSlot(Compound comp, String slotName)
      Searches for a slot in comp or its refined compounds.
      Parameters:
      comp - the compound to search
      slotName - 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: ConstraintSyntaxTree
      Infers the datatype of the subtree represented by this object.
      Specified by:
      inferDatatype in class ConstraintSyntaxTree
      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 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 if inferDatatype() 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: ConstraintSyntaxTree
      Visiting method for the visitor.
      This method is used for saving this model element.
      Specified by:
      accept in class ConstraintSyntaxTree
      Parameters:
      visitor - The visitor, which should save this model element.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object