Class DatatypeVisitor

java.lang.Object
net.ssehub.easy.varModel.model.datatypes.DatatypeVisitor
All Implemented Interfaces:
IDatatypeVisitor
Direct Known Subclasses:
IvmlDatatypeVisitor, ModelQuery.MqDatatypeVisitor

public abstract class DatatypeVisitor extends Object implements IDatatypeVisitor
Implements a default visitor where contained types are surrounded by their containing types.
Author:
Holger Eichelberger
  • Field Details

    • setPrefix

      private String setPrefix
    • sequencePrefix

      private String sequencePrefix
    • refPrefix

      private String refPrefix
    • open

      private String open
    • close

      private String close
    • builder

      private StringBuilder builder
      Collects results.
    • qualifiedNameMode

      private QualifiedNameMode qualifiedNameMode
      Stores whether qualified names shall be collected.
  • Constructor Details

    • DatatypeVisitor

      protected DatatypeVisitor(String setPrefix, String sequencePrefix, String refPrefix)
      Constructs a surrounding visitor (which particularly handles set, sequence and refs).
      Parameters:
      setPrefix - the prefix for sets
      sequencePrefix - the prefix for sequences
      refPrefix - the prefix for references
    • DatatypeVisitor

      protected DatatypeVisitor(String setPrefix, String sequencePrefix, String refPrefix, String open, String close)
      Constructs a surrounding visitor (which particularly handles set, sequence and refs).
      Parameters:
      setPrefix - the prefix for sets
      sequencePrefix - the prefix for sequences
      refPrefix - the prefix for references
      open - the string to be appended after a prefix and before the contained type
      close - the string to be appended after the contained type
  • Method Details

    • append

      protected void append(String text)
      Appends the given string to the result.
      Parameters:
      text - the string to be appended
    • getResult

      public String getResult()
      Returns the result.
      Returns:
      the result
    • getQualifiedNameMode

      public QualifiedNameMode getQualifiedNameMode()
      Returns the mode to be applied when collecting names.
      Returns:
      the collection mode
    • setQualifiedNameMode

      public void setQualifiedNameMode(QualifiedNameMode qualifiedNameMode)
      Switches the mode for considering names.
      Parameters:
      qualifiedNameMode - the new mode
    • clear

      public void clear()
      Clears the result.
    • visitDatatype

      public void visitDatatype(IDatatype datatype)
      Description copied from interface: IDatatypeVisitor
      Is called by an arbitrary data type.
      Specified by:
      visitDatatype in interface IDatatypeVisitor
      Parameters:
      datatype - the data type.
    • visitSet

      public void visitSet(Set set)
      Description copied from interface: IDatatypeVisitor
      Is called by a set data type.
      Specified by:
      visitSet in interface IDatatypeVisitor
      Parameters:
      set - the set instance
    • visitSequence

      public void visitSequence(Sequence sequence)
      Description copied from interface: IDatatypeVisitor
      Is called by a sequence datatype.
      Specified by:
      visitSequence in interface IDatatypeVisitor
      Parameters:
      sequence - the sequence instance
    • visitReference

      public void visitReference(Reference ref)
      Description copied from interface: IDatatypeVisitor
      Is called by a reference data type.
      Specified by:
      visitReference in interface IDatatypeVisitor
      Parameters:
      ref - the references instance
    • constructReferenceName

      public void constructReferenceName(IDatatype type)
      Constructs a reference name from the given contained type.
      Parameters:
      type - the contained type
    • constructSurrounded

      protected void constructSurrounded(String prefix, IDatatype type)
      Constructs a surrounded datatype, i.e. the prefix(type-visited).
      Parameters:
      prefix - the prefix to be used
      type - the (contained) type to be visited
    • visitBooleanType

      public void visitBooleanType(BooleanType type)
      Description copied from interface: IDatatypeVisitor
      Visiting method for visiting a BooleanType.
      Specified by:
      visitBooleanType in interface IDatatypeVisitor
      Parameters:
      type - The IDatatype which should be visited.
    • visitConstraintType

      public void visitConstraintType(ConstraintType type)
      Description copied from interface: IDatatypeVisitor
      Visiting method for visiting a ConstraintType.
      Specified by:
      visitConstraintType in interface IDatatypeVisitor
      Parameters:
      type - The IDatatype which should be visited.
    • visitAnyType

      public void visitAnyType(AnyType type)
      Description copied from interface: IDatatypeVisitor
      Is called by an AnyType.
      Specified by:
      visitAnyType in interface IDatatypeVisitor
      Parameters:
      type - the data type.
    • visitMetaType

      public void visitMetaType(MetaType type)
      Description copied from interface: IDatatypeVisitor
      Is called by a MetaType.
      Specified by:
      visitMetaType in interface IDatatypeVisitor
      Parameters:
      type - the data type.
    • visitStringType

      public void visitStringType(StringType type)
      Description copied from interface: IDatatypeVisitor
      Visiting method for visiting a StringType.
      Specified by:
      visitStringType in interface IDatatypeVisitor
      Parameters:
      type - The IDatatype which should be visited.
    • visitIntegerType

      public void visitIntegerType(IntegerType type)
      Description copied from interface: IDatatypeVisitor
      Visiting method for visiting a IntegerType.
      Specified by:
      visitIntegerType in interface IDatatypeVisitor
      Parameters:
      type - The IDatatype which should be visited.
    • visitRealType

      public void visitRealType(RealType type)
      Description copied from interface: IDatatypeVisitor
      Visiting method for visiting a RealType.
      Specified by:
      visitRealType in interface IDatatypeVisitor
      Parameters:
      type - The IDatatype which should be visited.
    • getType

      public String getType(IDatatype type)
      Returns the textual representation of this type.
      Parameters:
      type - the type to be represented
      Returns:
      the textual representation
    • visitCompoundType

      public void visitCompoundType(Compound compound)
      Description copied from interface: IDatatypeVisitor
      Visiting method for visiting a Compound.
      Specified by:
      visitCompoundType in interface IDatatypeVisitor
      Parameters:
      compound - The Compound which should be visited.
    • visitEnumType

      public void visitEnumType(Enum enumType)
      Description copied from interface: IDatatypeVisitor
      Visiting method for visiting a Enum.
      Specified by:
      visitEnumType in interface IDatatypeVisitor
      Parameters:
      enumType - The Enum which should be visited.
    • visitOrderedEnumType

      public void visitOrderedEnumType(OrderedEnum enumType)
      Description copied from interface: IDatatypeVisitor
      Visiting method for visiting a OrderredEnum.
      Specified by:
      visitOrderedEnumType in interface IDatatypeVisitor
      Parameters:
      enumType - The Enum which should be visited.
    • visitDerivedType

      public void visitDerivedType(DerivedDatatype datatype)
      Description copied from interface: IDatatypeVisitor
      Is called by an DerivedDatatype data type.
      Specified by:
      visitDerivedType in interface IDatatypeVisitor
      Parameters:
      datatype - the data type.
    • visitVersionType

      public void visitVersionType(VersionType type)
      Description copied from interface: IDatatypeVisitor
      Visiting method for visiting a VersionType.
      Specified by:
      visitVersionType in interface IDatatypeVisitor
      Parameters:
      type - The IDatatype which should be visited.