Class DeclarationFinder
java.lang.Object
net.ssehub.easy.varModel.model.AbstractProjectVisitor
net.ssehub.easy.varModel.model.filter.AbstractDeclarationFinder
net.ssehub.easy.varModel.model.filter.DeclarationFinder
- All Implemented Interfaces:
ICustomDatatypeVisitor,IModelVisitor
This class locates all top-level DecisionVariableDeclaration in a project.
- Author:
- beck, El-Sharkawy
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSpecifies which kind of found declarations shall by returned. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<AbstractVariable> private List<AbstractVariable> private Stack<Set<AbstractVariable>> private booleanprivate IDatatypeprivate List<AbstractVariable> -
Constructor Summary
ConstructorsConstructorDescriptionDeclarationFinder(Project project, FilterType filterType, IDatatype type) Constructor for specifying whether search results should be filtered regarding the specifiedIDatatype.DeclarationFinder(Project project, FilterType filterType, IDatatype type, boolean onlyToplevel) Constructor for specifying whether search results should be filtered regarding the specifiedIDatatypeand whether only toplevel variables should be retrieved. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidAdds a visitedAbstractVariableto the correct list of found declarations, depending on whether the variable is visible (no interface or exported by an interface) or is hidden.Getter for returning all DecisionVariableDeclarations of a Project.private booleanisVisible(AbstractVariable decl) Checks whether a given variables is hidden by an interface or visible.voidvisitAttributeAssignment(AttributeAssignment assignment) Visits an attribute assignment.voidvisitCompound(Compound compound) Method for visiting a compound.voidVisits a compound access statement (may occur in freeze blocks.voidThis method is used for visiting a decision variable declaration.voidvisitProjectImport(ProjectImport pImport) This method is used for visiting a ProjectImport.Methods inherited from class net.ssehub.easy.varModel.model.filter.AbstractDeclarationFinder
visitAttribute, visitComment, visitConstraint, visitDerivedDatatype, visitEnum, visitEnumLiteral, visitFreezeBlock, visitOperationDefinition, visitOrderedEnum, visitPartialEvaluationBlock, visitProjectInterface, visitReference, visitSequence, visitSetMethods inherited from class net.ssehub.easy.varModel.model.AbstractProjectVisitor
clear, getFilterType, getStartingProject, visitProject
-
Field Details
-
visibleDeclarations
-
allDeclarations
-
type
-
interfaces
-
onlyToplevel
private boolean onlyToplevel
-
-
Constructor Details
-
DeclarationFinder
Constructor for specifying whether search results should be filtered regarding the specifiedIDatatype. Will only find toplevel declarations.- Parameters:
project- The project where all DecisionVariableDeclarations should be found.filterType- Specifies whether project imports shall be considered or not.type- If type is not null only declarations matching the specified type will be found
-
DeclarationFinder
public DeclarationFinder(Project project, FilterType filterType, IDatatype type, boolean onlyToplevel) Constructor for specifying whether search results should be filtered regarding the specifiedIDatatypeand whether only toplevel variables should be retrieved.- Parameters:
project- The project where all DecisionVariableDeclarations should be found.filterType- Specifies whether project imports shall be considered or not.type- If type is not null only declarations matching the specified type will be foundonlyToplevel-trueonly toplevel declarations will be found,falsewill also consider declarations inside compounds.
-
-
Method Details
-
getVariableDeclarations
Getter for returning all DecisionVariableDeclarations of a Project.- Parameters:
type- Specification whether only exported, not exported, or all declarations shall be returned:DeclarationFinder.VisibilityType.ONLY_EXPORTED: All variables which are not hidden by an interface will be returned.DeclarationFinder.VisibilityType.ONLY_HIDDEN: All variables which are hidden by an interface will be returned.DeclarationFinder.VisibilityType.ALL: All variables be returned.
- Returns:
- A List with all top-level DecisionVariableDeclarations
-
visitProjectImport
Description copied from interface:IModelVisitorThis method is used for visiting a ProjectImport.- Specified by:
visitProjectImportin interfaceIModelVisitor- Overrides:
visitProjectImportin classAbstractProjectVisitor- Parameters:
pImport- One ProjectImport which should be visited.
-
visitDecisionVariableDeclaration
Description copied from interface:IModelVisitorThis method is used for visiting a decision variable declaration.- Parameters:
decl- One declaration which should be visited.
-
visitAttributeAssignment
Description copied from interface:IModelVisitorVisits an attribute assignment.- Parameters:
assignment- the assignment to visit
-
isVisible
Checks whether a given variables is hidden by an interface or visible.- Parameters:
decl- TheAbstractVariableto check.- Returns:
falseif the variable is hidden by an interface,trueotherwise
-
addDeclaration
Adds a visitedAbstractVariableto the correct list of found declarations, depending on whether the variable is visible (no interface or exported by an interface) or is hidden.- Parameters:
decl- AAbstractVariablewhich shall be added to the list found declarations (getVariableDeclarations(VisibilityType).- See Also:
-
visitCompoundAccessStatement
Description copied from interface:IModelVisitorVisits a compound access statement (may occur in freeze blocks.- Parameters:
access- the access statement
-
visitCompound
Description copied from interface:ICustomDatatypeVisitorMethod for visiting a compound.- Specified by:
visitCompoundin interfaceICustomDatatypeVisitor- Overrides:
visitCompoundin classAbstractDeclarationFinder- Parameters:
compound- The compound which should be visited.
-