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 java.lang.Object implements IDatatypeVisitor
Implements a default visitor where contained types are surrounded by their containing types.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringBuilderbuilderCollects results.private java.lang.Stringcloseprivate java.lang.Stringopenprivate QualifiedNameModequalifiedNameModeStores whether qualified names shall be collected.private java.lang.StringrefPrefixprivate java.lang.StringsequencePrefixprivate java.lang.StringsetPrefix
-
Constructor Summary
Constructors Modifier Constructor Description protectedDatatypeVisitor(java.lang.String setPrefix, java.lang.String sequencePrefix, java.lang.String refPrefix)Constructs a surrounding visitor (which particularly handles set, sequence and refs).protectedDatatypeVisitor(java.lang.String setPrefix, java.lang.String sequencePrefix, java.lang.String refPrefix, java.lang.String open, java.lang.String close)Constructs a surrounding visitor (which particularly handles set, sequence and refs).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappend(java.lang.String text)Appends the given string to the result.voidclear()Clears the result.voidconstructReferenceName(IDatatype type)Constructs a reference name from the given containedtype.protected voidconstructSurrounded(java.lang.String prefix, IDatatype type)Constructs a surrounded datatype, i.e.QualifiedNameModegetQualifiedNameMode()Returns the mode to be applied when collecting names.java.lang.StringgetResult()Returns the result.java.lang.StringgetType(IDatatype type)Returns the textual representation of this type.voidsetQualifiedNameMode(QualifiedNameMode qualifiedNameMode)Switches the mode for considering names.voidvisitAnyType(AnyType type)Is called by an AnyType.voidvisitBooleanType(BooleanType type)Visiting method for visiting aBooleanType.voidvisitCompoundType(Compound compound)Visiting method for visiting aCompound.voidvisitConstraintType(ConstraintType type)Visiting method for visiting aConstraintType.voidvisitDatatype(IDatatype datatype)Is called by an arbitrary data type.voidvisitDerivedType(DerivedDatatype datatype)Is called by anDerivedDatatypedata type.voidvisitEnumType(Enum enumType)Visiting method for visiting aEnum.voidvisitIntegerType(IntegerType type)Visiting method for visiting aIntegerType.voidvisitMetaType(MetaType type)Is called by a MetaType.voidvisitOrderedEnumType(OrderedEnum enumType)Visiting method for visiting aOrderredEnum.voidvisitRealType(RealType type)Visiting method for visiting aRealType.voidvisitReference(Reference ref)Is called by a reference data type.voidvisitSequence(Sequence sequence)Is called by a sequence datatype.voidvisitSet(Set set)Is called by a set data type.voidvisitStringType(StringType type)Visiting method for visiting aStringType.voidvisitVersionType(VersionType type)Visiting method for visiting aVersionType.
-
-
-
Field Detail
-
setPrefix
private java.lang.String setPrefix
-
sequencePrefix
private java.lang.String sequencePrefix
-
refPrefix
private java.lang.String refPrefix
-
open
private java.lang.String open
-
close
private java.lang.String close
-
builder
private java.lang.StringBuilder builder
Collects results.
-
qualifiedNameMode
private QualifiedNameMode qualifiedNameMode
Stores whether qualified names shall be collected.
-
-
Constructor Detail
-
DatatypeVisitor
protected DatatypeVisitor(java.lang.String setPrefix, java.lang.String sequencePrefix, java.lang.String refPrefix)Constructs a surrounding visitor (which particularly handles set, sequence and refs).- Parameters:
setPrefix- the prefix for setssequencePrefix- the prefix for sequencesrefPrefix- the prefix for references
-
DatatypeVisitor
protected DatatypeVisitor(java.lang.String setPrefix, java.lang.String sequencePrefix, java.lang.String refPrefix, java.lang.String open, java.lang.String close)Constructs a surrounding visitor (which particularly handles set, sequence and refs).- Parameters:
setPrefix- the prefix for setssequencePrefix- the prefix for sequencesrefPrefix- the prefix for referencesopen- the string to be appended after a prefix and before the contained typeclose- the string to be appended after the contained type
-
-
Method Detail
-
append
protected void append(java.lang.String text)
Appends the given string to the result.- Parameters:
text- the string to be appended
-
getResult
public java.lang.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:IDatatypeVisitorIs called by an arbitrary data type.- Specified by:
visitDatatypein interfaceIDatatypeVisitor- Parameters:
datatype- the data type.
-
visitSet
public void visitSet(Set set)
Description copied from interface:IDatatypeVisitorIs called by a set data type.- Specified by:
visitSetin interfaceIDatatypeVisitor- Parameters:
set- the set instance
-
visitSequence
public void visitSequence(Sequence sequence)
Description copied from interface:IDatatypeVisitorIs called by a sequence datatype.- Specified by:
visitSequencein interfaceIDatatypeVisitor- Parameters:
sequence- the sequence instance
-
visitReference
public void visitReference(Reference ref)
Description copied from interface:IDatatypeVisitorIs called by a reference data type.- Specified by:
visitReferencein interfaceIDatatypeVisitor- Parameters:
ref- the references instance
-
constructReferenceName
public void constructReferenceName(IDatatype type)
Constructs a reference name from the given containedtype.- Parameters:
type- the contained type
-
constructSurrounded
protected void constructSurrounded(java.lang.String prefix, IDatatype type)Constructs a surrounded datatype, i.e. theprefix(type-visited).- Parameters:
prefix- the prefix to be usedtype- the (contained) type to be visited
-
visitBooleanType
public void visitBooleanType(BooleanType type)
Description copied from interface:IDatatypeVisitorVisiting method for visiting aBooleanType.- Specified by:
visitBooleanTypein interfaceIDatatypeVisitor- Parameters:
type- TheIDatatypewhich should be visited.
-
visitConstraintType
public void visitConstraintType(ConstraintType type)
Description copied from interface:IDatatypeVisitorVisiting method for visiting aConstraintType.- Specified by:
visitConstraintTypein interfaceIDatatypeVisitor- Parameters:
type- TheIDatatypewhich should be visited.
-
visitAnyType
public void visitAnyType(AnyType type)
Description copied from interface:IDatatypeVisitorIs called by an AnyType.- Specified by:
visitAnyTypein interfaceIDatatypeVisitor- Parameters:
type- the data type.
-
visitMetaType
public void visitMetaType(MetaType type)
Description copied from interface:IDatatypeVisitorIs called by a MetaType.- Specified by:
visitMetaTypein interfaceIDatatypeVisitor- Parameters:
type- the data type.
-
visitStringType
public void visitStringType(StringType type)
Description copied from interface:IDatatypeVisitorVisiting method for visiting aStringType.- Specified by:
visitStringTypein interfaceIDatatypeVisitor- Parameters:
type- TheIDatatypewhich should be visited.
-
visitIntegerType
public void visitIntegerType(IntegerType type)
Description copied from interface:IDatatypeVisitorVisiting method for visiting aIntegerType.- Specified by:
visitIntegerTypein interfaceIDatatypeVisitor- Parameters:
type- TheIDatatypewhich should be visited.
-
visitRealType
public void visitRealType(RealType type)
Description copied from interface:IDatatypeVisitorVisiting method for visiting aRealType.- Specified by:
visitRealTypein interfaceIDatatypeVisitor- Parameters:
type- TheIDatatypewhich should be visited.
-
getType
public java.lang.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:IDatatypeVisitorVisiting method for visiting aCompound.- Specified by:
visitCompoundTypein interfaceIDatatypeVisitor- Parameters:
compound- TheCompoundwhich should be visited.
-
visitEnumType
public void visitEnumType(Enum enumType)
Description copied from interface:IDatatypeVisitorVisiting method for visiting aEnum.- Specified by:
visitEnumTypein interfaceIDatatypeVisitor- Parameters:
enumType- TheEnumwhich should be visited.
-
visitOrderedEnumType
public void visitOrderedEnumType(OrderedEnum enumType)
Description copied from interface:IDatatypeVisitorVisiting method for visiting aOrderredEnum.- Specified by:
visitOrderedEnumTypein interfaceIDatatypeVisitor- Parameters:
enumType- TheEnumwhich should be visited.
-
visitDerivedType
public void visitDerivedType(DerivedDatatype datatype)
Description copied from interface:IDatatypeVisitorIs called by anDerivedDatatypedata type.- Specified by:
visitDerivedTypein interfaceIDatatypeVisitor- Parameters:
datatype- the data type.
-
visitVersionType
public void visitVersionType(VersionType type)
Description copied from interface:IDatatypeVisitorVisiting method for visiting aVersionType.- Specified by:
visitVersionTypein interfaceIDatatypeVisitor- Parameters:
type- TheIDatatypewhich should be visited.
-
-