Class ModelElementTypeFinder
- java.lang.Object
-
- net.ssehub.easy.varModel.model.AbstractProjectVisitor
-
- net.ssehub.easy.varModel.model.filter.ModelElementTypeFinder
-
- All Implemented Interfaces:
ICustomDatatypeVisitor,IModelVisitor
public class ModelElementTypeFinder extends AbstractProjectVisitor
This class provides a visitor for providing aModelElementTypeFinder.ModelElementDescriptionof a model element in a specificProject. The search for the desired model element only requires the name of that element and theProjectthe element is located in.- Author:
- kroeher
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classModelElementTypeFinder.ClassTypeType descriptions.classModelElementTypeFinder.ModelElementDescriptionThis inner class is used as return type of the outerModelElementTypeFinderthat stores the relevant information (name, type, and class) of the model element found in aProject.
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringCOMPOUND_TYPEprivate static java.lang.StringDECISION_VARIABLE_TYPEConstant strings that are used to mapModelElementTypeFinder.ClassTypes to a textual representation.private ModelElementTypeFinder.ModelElementDescriptionelementTypeDescriptionStores the description of the the model element found in a givenProject.private static java.lang.StringENUM_TYPEprivate static java.lang.StringMAPPING_TYPEprivate java.lang.StringsearchElementNameStores the name of the model element for which theModelElementTypeFinder.ModelElementDescriptionshould be found.private ProjecttargetProjectStores theProjectin which the model element is located.
-
Constructor Summary
Constructors Constructor Description ModelElementTypeFinder(Project originProject, FilterType filterType)Constructs a newModelElementTypeFinder.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private ModelElementTypeFinder.ClassTypegetClassTypeFromFreezable(IFreezable freezable)Returns theModelElementTypeFinder.ClassTypethe givenIFreezableis an instance of.ModelElementTypeFinder.ModelElementDescriptiongetDatatypeByElementName(java.lang.String elementName)Returns aModelElementTypeFinder.ModelElementDescriptionof the model element specified by the given element name.static java.lang.StringtoString(ModelElementTypeFinder.ClassType type)Returns the textual representation of aModelElementTypeFinder.ClassType.voidvisitAttribute(Attribute attribute)Method for visiting an attribute.voidvisitAttributeAssignment(AttributeAssignment assignment)Visits an attribute assignment.voidvisitComment(Comment comment)Method for visiting a comment.voidvisitCompound(Compound compound)Method for visiting a compound.voidvisitCompoundAccessStatement(CompoundAccessStatement access)Visits a compound access statement (may occur in freeze blocks.voidvisitConstraint(Constraint constraint)Method for visiting a constraint.voidvisitDecisionVariableDeclaration(DecisionVariableDeclaration decl)This method is used for visiting a decision variable declaration.voidvisitDerivedDatatype(DerivedDatatype datatype)Method for visiting a derived datatype.voidvisitEnum(Enum eenum)Method for visiting an enum.voidvisitEnumLiteral(EnumLiteral literal)Method for visiting an enum literal.voidvisitFreezeBlock(FreezeBlock freeze)Method for visiting a freeze block.voidvisitOperationDefinition(OperationDefinition opdef)Method for visiting an operation definition.voidvisitOrderedEnum(OrderedEnum eenum)Method for visiting an ordered enum.voidvisitPartialEvaluationBlock(PartialEvaluationBlock block)Method for visiting a partial evaluation block.voidvisitProjectInterface(ProjectInterface iface)Method for visiting a project interface.voidvisitReference(Reference reference)Method for visiting a reference.voidvisitSequence(Sequence sequence)Method for visiting a sequence.voidvisitSet(Set set)Method for visiting a set.-
Methods inherited from class net.ssehub.easy.varModel.model.AbstractProjectVisitor
clear, getFilterType, getStartingProject, visitProject, visitProjectImport
-
-
-
-
Field Detail
-
DECISION_VARIABLE_TYPE
private static final java.lang.String DECISION_VARIABLE_TYPE
Constant strings that are used to mapModelElementTypeFinder.ClassTypes to a textual representation.- See Also:
- Constant Field Values
-
ENUM_TYPE
private static final java.lang.String ENUM_TYPE
- See Also:
- Constant Field Values
-
COMPOUND_TYPE
private static final java.lang.String COMPOUND_TYPE
- See Also:
- Constant Field Values
-
MAPPING_TYPE
private static final java.lang.String MAPPING_TYPE
- See Also:
- Constant Field Values
-
elementTypeDescription
private ModelElementTypeFinder.ModelElementDescription elementTypeDescription
Stores the description of the the model element found in a givenProject.
-
targetProject
private Project targetProject
Stores theProjectin which the model element is located.
-
searchElementName
private java.lang.String searchElementName
Stores the name of the model element for which theModelElementTypeFinder.ModelElementDescriptionshould be found.
-
-
Constructor Detail
-
ModelElementTypeFinder
public ModelElementTypeFinder(Project originProject, FilterType filterType)
Constructs a newModelElementTypeFinder.- Parameters:
originProject- theProjectin which the model element is locatedfilterType- specifies whether project imports shall be considered or not using aFilterType
-
-
Method Detail
-
getDatatypeByElementName
public ModelElementTypeFinder.ModelElementDescription getDatatypeByElementName(java.lang.String elementName)
Returns aModelElementTypeFinder.ModelElementDescriptionof the model element specified by the given element name.- Parameters:
elementName- the name of the model element as aStringfor which the description should be created- Returns:
- the
ModelElementTypeFinder.ModelElementDescription. May returnnullif the given model element name is empty, theProjectdoes not exist, or the element could not be found.
-
visitDecisionVariableDeclaration
public void visitDecisionVariableDeclaration(DecisionVariableDeclaration decl)
Description copied from interface:IModelVisitorThis method is used for visiting a decision variable declaration.- Parameters:
decl- One declaration which should be visited.
-
visitAttribute
public void visitAttribute(Attribute attribute)
Description copied from interface:IModelVisitorMethod for visiting an attribute.- Parameters:
attribute- The attribute which should be visited.
-
visitConstraint
public void visitConstraint(Constraint constraint)
Description copied from interface:IModelVisitorMethod for visiting a constraint.- Parameters:
constraint- The constraint which should be visited.
-
visitFreezeBlock
public void visitFreezeBlock(FreezeBlock freeze)
Description copied from interface:IModelVisitorMethod for visiting a freeze block.- Parameters:
freeze- The freeze block which should be visited.
-
getClassTypeFromFreezable
private ModelElementTypeFinder.ClassType getClassTypeFromFreezable(IFreezable freezable)
Returns theModelElementTypeFinder.ClassTypethe givenIFreezableis an instance of.- Parameters:
freezable- theIFreezablefor which the actualModelElementTypeFinder.ClassTypeshould be determined- Returns:
- the
ModelElementTypeFinder.ClassTypethe givenIFreezableis an instance of ornullif there is noModelElementTypeFinder.ClassTypefor the actual type of theIFreezabledefined.
-
visitOperationDefinition
public void visitOperationDefinition(OperationDefinition opdef)
Description copied from interface:IModelVisitorMethod for visiting an operation definition.- Parameters:
opdef- The operation definition which should be visited.
-
visitPartialEvaluationBlock
public void visitPartialEvaluationBlock(PartialEvaluationBlock block)
Description copied from interface:IModelVisitorMethod for visiting a partial evaluation block.- Parameters:
block- The partial evaluation block which should be visited.
-
visitProjectInterface
public void visitProjectInterface(ProjectInterface iface)
Description copied from interface:IModelVisitorMethod for visiting a project interface.- Parameters:
iface- The interface which should be visited.
-
visitComment
public void visitComment(Comment comment)
Description copied from interface:IModelVisitorMethod for visiting a comment.- Parameters:
comment- the comment to visit
-
visitAttributeAssignment
public void visitAttributeAssignment(AttributeAssignment assignment)
Description copied from interface:IModelVisitorVisits an attribute assignment.- Parameters:
assignment- the assignment to visit
-
visitCompoundAccessStatement
public void visitCompoundAccessStatement(CompoundAccessStatement access)
Description copied from interface:IModelVisitorVisits a compound access statement (may occur in freeze blocks.- Parameters:
access- the access statement
-
visitEnum
public void visitEnum(Enum eenum)
Description copied from interface:ICustomDatatypeVisitorMethod for visiting an enum.- Parameters:
eenum- The enum which should be visited.
-
visitOrderedEnum
public void visitOrderedEnum(OrderedEnum eenum)
Description copied from interface:ICustomDatatypeVisitorMethod for visiting an ordered enum.- Parameters:
eenum- The enum which should be visited.
-
visitCompound
public void visitCompound(Compound compound)
Description copied from interface:ICustomDatatypeVisitorMethod for visiting a compound.- Parameters:
compound- The compound which should be visited.
-
visitDerivedDatatype
public void visitDerivedDatatype(DerivedDatatype datatype)
Description copied from interface:ICustomDatatypeVisitorMethod for visiting a derived datatype.- Parameters:
datatype- The datatype which should be visited.
-
visitEnumLiteral
public void visitEnumLiteral(EnumLiteral literal)
Description copied from interface:ICustomDatatypeVisitorMethod for visiting an enum literal.- Parameters:
literal- The literal which should be visited.
-
visitReference
public void visitReference(Reference reference)
Description copied from interface:ICustomDatatypeVisitorMethod for visiting a reference.- Parameters:
reference- The reference which should be visited.
-
visitSequence
public void visitSequence(Sequence sequence)
Description copied from interface:ICustomDatatypeVisitorMethod for visiting a sequence.- Parameters:
sequence- The sequence which should be visited.
-
visitSet
public void visitSet(Set set)
Description copied from interface:ICustomDatatypeVisitorMethod for visiting a set.- Parameters:
set- The set which should be visited.
-
toString
public static java.lang.String toString(ModelElementTypeFinder.ClassType type)
Returns the textual representation of aModelElementTypeFinder.ClassType.- Parameters:
type- theModelElementTypeFinder.ClassTypeto be turned into aString- Returns:
- the textual representation of the given
ModelElementTypeFinder.ClassType. May return an emptyStringif the givenModelElementTypeFinder.ClassTypecannot be resolved.
-
-