Class DatatypeVisitor
java.lang.Object
net.ssehub.easy.varModel.model.datatypes.DatatypeVisitor
- All Implemented Interfaces:
IDatatypeVisitor
- Direct Known Subclasses:
IvmlDatatypeVisitor,ModelQuery.MqDatatypeVisitor
Implements a default visitor where contained types are surrounded
by their containing types.
- Author:
- Holger Eichelberger
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringBuilderCollects results.private Stringprivate Stringprivate QualifiedNameModeStores whether qualified names shall be collected.private Stringprivate Stringprivate String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDatatypeVisitor(String setPrefix, String sequencePrefix, String refPrefix) Constructs a surrounding visitor (which particularly handles set, sequence and refs).protectedDatatypeVisitor(String setPrefix, String sequencePrefix, String refPrefix, String open, String close) Constructs a surrounding visitor (which particularly handles set, sequence and refs). -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAppends the given string to the result.voidclear()Clears the result.voidConstructs a reference name from the given containedtype.protected voidconstructSurrounded(String prefix, IDatatype type) Constructs a surrounded datatype, i.e.Returns the mode to be applied when collecting names.Returns the result.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.voidVisiting 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.voidIs called by a set data type.voidvisitStringType(StringType type) Visiting method for visiting aStringType.voidvisitVersionType(VersionType type) Visiting method for visiting aVersionType.
-
Field Details
-
setPrefix
-
sequencePrefix
-
refPrefix
-
open
-
close
-
builder
Collects results. -
qualifiedNameMode
Stores whether qualified names shall be collected.
-
-
Constructor Details
-
DatatypeVisitor
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(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 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 Details
-
append
Appends the given string to the result.- Parameters:
text- the string to be appended
-
getResult
Returns the result.- Returns:
- the result
-
getQualifiedNameMode
Returns the mode to be applied when collecting names.- Returns:
- the collection mode
-
setQualifiedNameMode
Switches the mode for considering names.- Parameters:
qualifiedNameMode- the new mode
-
clear
public void clear()Clears the result. -
visitDatatype
Description copied from interface:IDatatypeVisitorIs called by an arbitrary data type.- Specified by:
visitDatatypein interfaceIDatatypeVisitor- Parameters:
datatype- the data type.
-
visitSet
Description copied from interface:IDatatypeVisitorIs called by a set data type.- Specified by:
visitSetin interfaceIDatatypeVisitor- Parameters:
set- the set instance
-
visitSequence
Description copied from interface:IDatatypeVisitorIs called by a sequence datatype.- Specified by:
visitSequencein interfaceIDatatypeVisitor- Parameters:
sequence- the sequence instance
-
visitReference
Description copied from interface:IDatatypeVisitorIs called by a reference data type.- Specified by:
visitReferencein interfaceIDatatypeVisitor- Parameters:
ref- the references instance
-
constructReferenceName
Constructs a reference name from the given containedtype.- Parameters:
type- the contained type
-
constructSurrounded
Constructs a surrounded datatype, i.e. theprefix(type-visited).- Parameters:
prefix- the prefix to be usedtype- the (contained) type to be visited
-
visitBooleanType
Description copied from interface:IDatatypeVisitorVisiting method for visiting aBooleanType.- Specified by:
visitBooleanTypein interfaceIDatatypeVisitor- Parameters:
type- TheIDatatypewhich should be visited.
-
visitConstraintType
Description copied from interface:IDatatypeVisitorVisiting method for visiting aConstraintType.- Specified by:
visitConstraintTypein interfaceIDatatypeVisitor- Parameters:
type- TheIDatatypewhich should be visited.
-
visitAnyType
Description copied from interface:IDatatypeVisitorIs called by an AnyType.- Specified by:
visitAnyTypein interfaceIDatatypeVisitor- Parameters:
type- the data type.
-
visitMetaType
Description copied from interface:IDatatypeVisitorIs called by a MetaType.- Specified by:
visitMetaTypein interfaceIDatatypeVisitor- Parameters:
type- the data type.
-
visitStringType
Description copied from interface:IDatatypeVisitorVisiting method for visiting aStringType.- Specified by:
visitStringTypein interfaceIDatatypeVisitor- Parameters:
type- TheIDatatypewhich should be visited.
-
visitIntegerType
Description copied from interface:IDatatypeVisitorVisiting method for visiting aIntegerType.- Specified by:
visitIntegerTypein interfaceIDatatypeVisitor- Parameters:
type- TheIDatatypewhich should be visited.
-
visitRealType
Description copied from interface:IDatatypeVisitorVisiting method for visiting aRealType.- Specified by:
visitRealTypein interfaceIDatatypeVisitor- Parameters:
type- TheIDatatypewhich should be visited.
-
getType
Returns the textual representation of this type.- Parameters:
type- the type to be represented- Returns:
- the textual representation
-
visitCompoundType
Description copied from interface:IDatatypeVisitorVisiting method for visiting aCompound.- Specified by:
visitCompoundTypein interfaceIDatatypeVisitor- Parameters:
compound- TheCompoundwhich should be visited.
-
visitEnumType
Description copied from interface:IDatatypeVisitorVisiting method for visiting aEnum.- Specified by:
visitEnumTypein interfaceIDatatypeVisitor- Parameters:
enumType- TheEnumwhich should be visited.
-
visitOrderedEnumType
Description copied from interface:IDatatypeVisitorVisiting method for visiting aOrderredEnum.- Specified by:
visitOrderedEnumTypein interfaceIDatatypeVisitor- Parameters:
enumType- TheEnumwhich should be visited.
-
visitDerivedType
Description copied from interface:IDatatypeVisitorIs called by anDerivedDatatypedata type.- Specified by:
visitDerivedTypein interfaceIDatatypeVisitor- Parameters:
datatype- the data type.
-
visitVersionType
Description copied from interface:IDatatypeVisitorVisiting method for visiting aVersionType.- Specified by:
visitVersionTypein interfaceIDatatypeVisitor- Parameters:
type- TheIDatatypewhich should be visited.
-