Class ConstraintFinder
- java.lang.Object
-
- net.ssehub.easy.varModel.model.filter.ConstraintFinder
-
- All Implemented Interfaces:
ICustomDatatypeVisitor,IModelVisitor
- Direct Known Subclasses:
ConstraintFunctions.TransitiveConstraintFinder
public class ConstraintFinder extends java.lang.Object implements IModelVisitor
This class locates all (visible) constraints in an IVML project.- Author:
- El-Sharkawy
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<AttributeAssignment>allAttributesprivate booleanconsiderImportsprivate java.util.List<Constraint>constraintsprivate java.util.List<Constraint>evalConstraintsprivate booleanexcludeAssignmentsprivate booleanhandleEvalsprivate booleanisEvalConstraint
-
Constructor Summary
Constructors Constructor Description ConstraintFinder(Project project)This constructor will consider imported projects.ConstraintFinder(Project project, boolean considerImports)Constructor for specifying whether imported projects should be considered while finding the constraints.ConstraintFinder(Project project, boolean considerImports, boolean excludeAssignments)Constructor for specifying whether imported projects should be considered while finding the constraints.ConstraintFinder(Project project, boolean considerImports, boolean excludeAssignments, boolean handleEvals)Constructor for specifying whether imported projects should be considered while finding the constraints.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<AttributeAssignment>getAttributeAssignments()Method for returning all attribute assignments.java.util.List<Constraint>getConstraints()Getter for returning all constraints (except eval) of an ivml project.java.util.List<Constraint>getEvalConstraints()Getter for returning eval constraints of an ivml project.protected voidstartAccept(Project project)Starts accepting in the constructor.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.voidvisitProject(Project project)Method for visiting a project.voidvisitProjectImport(ProjectImport pImport)This method is used for visiting a ProjectImport.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.
-
-
-
Field Detail
-
constraints
private java.util.List<Constraint> constraints
-
evalConstraints
private java.util.List<Constraint> evalConstraints
-
considerImports
private boolean considerImports
-
excludeAssignments
private boolean excludeAssignments
-
isEvalConstraint
private boolean isEvalConstraint
-
handleEvals
private boolean handleEvals
-
allAttributes
private java.util.List<AttributeAssignment> allAttributes
-
-
Constructor Detail
-
ConstraintFinder
public ConstraintFinder(Project project)
This constructor will consider imported projects.- Parameters:
project- The project, where all constraints should be found.
-
ConstraintFinder
public ConstraintFinder(Project project, boolean considerImports)
Constructor for specifying whether imported projects should be considered while finding the constraints.- Parameters:
project- The project, where all constraints should be found.considerImports- true if constraints of imported projects should also be found
-
ConstraintFinder
public ConstraintFinder(Project project, boolean considerImports, boolean excludeAssignments)
Constructor for specifying whether imported projects should be considered while finding the constraints.- Parameters:
project- The project, where all constraints should be found.considerImports- true if constraints of imported projects should also be foundexcludeAssignments- whether top-level assignments shall be excluded
-
ConstraintFinder
public ConstraintFinder(Project project, boolean considerImports, boolean excludeAssignments, boolean handleEvals)
Constructor for specifying whether imported projects should be considered while finding the constraints.- Parameters:
project- The project, where all constraints should be found.considerImports- true if constraints of imported projects should also be foundexcludeAssignments- whether top-level assignments shall be excludedhandleEvals- whether eval constraints should be separated from all constraints.
-
-
Method Detail
-
startAccept
protected void startAccept(Project project)
Starts accepting in the constructor. Overridden to allow for further initializations.- Parameters:
project- the project to start accepting
-
getConstraints
public java.util.List<Constraint> getConstraints()
Getter for returning all constraints (except eval) of an ivml project.- Returns:
- A list of all constraints in the specified ivml project.
-
getEvalConstraints
public java.util.List<Constraint> getEvalConstraints()
Getter for returning eval constraints of an ivml project.- Returns:
- A list of eval constraints in the specified ivml project.
-
getAttributeAssignments
public java.util.List<AttributeAssignment> getAttributeAssignments()
Method for returning all attribute assignments.- Returns:
- All attribute assignments.
-
visitEnum
public void visitEnum(Enum eenum)
Description copied from interface:ICustomDatatypeVisitorMethod for visiting an enum.- Specified by:
visitEnumin interfaceICustomDatatypeVisitor- Parameters:
eenum- The enum which should be visited.
-
visitOrderedEnum
public void visitOrderedEnum(OrderedEnum eenum)
Description copied from interface:ICustomDatatypeVisitorMethod for visiting an ordered enum.- Specified by:
visitOrderedEnumin interfaceICustomDatatypeVisitor- Parameters:
eenum- The enum which should be visited.
-
visitCompound
public void visitCompound(Compound compound)
Description copied from interface:ICustomDatatypeVisitorMethod for visiting a compound.- Specified by:
visitCompoundin interfaceICustomDatatypeVisitor- Parameters:
compound- The compound which should be visited.
-
visitAttributeAssignment
public void visitAttributeAssignment(AttributeAssignment assignment)
Description copied from interface:IModelVisitorVisits an attribute assignment.- Specified by:
visitAttributeAssignmentin interfaceIModelVisitor- Parameters:
assignment- the assignment to visit
-
visitDerivedDatatype
public void visitDerivedDatatype(DerivedDatatype datatype)
Description copied from interface:ICustomDatatypeVisitorMethod for visiting a derived datatype.- Specified by:
visitDerivedDatatypein interfaceICustomDatatypeVisitor- Parameters:
datatype- The datatype which should be visited.
-
visitEnumLiteral
public void visitEnumLiteral(EnumLiteral literal)
Description copied from interface:ICustomDatatypeVisitorMethod for visiting an enum literal.- Specified by:
visitEnumLiteralin interfaceICustomDatatypeVisitor- Parameters:
literal- The literal which should be visited.
-
visitReference
public void visitReference(Reference reference)
Description copied from interface:ICustomDatatypeVisitorMethod for visiting a reference.- Specified by:
visitReferencein interfaceICustomDatatypeVisitor- Parameters:
reference- The reference which should be visited.
-
visitSequence
public void visitSequence(Sequence sequence)
Description copied from interface:ICustomDatatypeVisitorMethod for visiting a sequence.- Specified by:
visitSequencein interfaceICustomDatatypeVisitor- Parameters:
sequence- The sequence which should be visited.
-
visitSet
public void visitSet(Set set)
Description copied from interface:ICustomDatatypeVisitorMethod for visiting a set.- Specified by:
visitSetin interfaceICustomDatatypeVisitor- Parameters:
set- The set which should be visited.
-
visitProject
public void visitProject(Project project)
Description copied from interface:IModelVisitorMethod for visiting a project.- Specified by:
visitProjectin interfaceIModelVisitor- Parameters:
project- The project which should be visited.
-
visitProjectImport
public void visitProjectImport(ProjectImport pImport)
Description copied from interface:IModelVisitorThis method is used for visiting a ProjectImport.- Specified by:
visitProjectImportin interfaceIModelVisitor- Parameters:
pImport- One ProjectImport which should be visited.
-
visitDecisionVariableDeclaration
public void visitDecisionVariableDeclaration(DecisionVariableDeclaration decl)
Description copied from interface:IModelVisitorThis method is used for visiting a decision variable declaration.- Specified by:
visitDecisionVariableDeclarationin interfaceIModelVisitor- Parameters:
decl- One declaration which should be visited.
-
visitAttribute
public void visitAttribute(Attribute attribute)
Description copied from interface:IModelVisitorMethod for visiting an attribute.- Specified by:
visitAttributein interfaceIModelVisitor- Parameters:
attribute- The attribute which should be visited.
-
visitConstraint
public void visitConstraint(Constraint constraint)
Description copied from interface:IModelVisitorMethod for visiting a constraint.- Specified by:
visitConstraintin interfaceIModelVisitor- Parameters:
constraint- The constraint which should be visited.
-
visitFreezeBlock
public void visitFreezeBlock(FreezeBlock freeze)
Description copied from interface:IModelVisitorMethod for visiting a freeze block.- Specified by:
visitFreezeBlockin interfaceIModelVisitor- Parameters:
freeze- The freeze block which should be visited.
-
visitOperationDefinition
public void visitOperationDefinition(OperationDefinition opdef)
Description copied from interface:IModelVisitorMethod for visiting an operation definition.- Specified by:
visitOperationDefinitionin interfaceIModelVisitor- 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.- Specified by:
visitPartialEvaluationBlockin interfaceIModelVisitor- 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.- Specified by:
visitProjectInterfacein interfaceIModelVisitor- Parameters:
iface- The interface which should be visited.
-
visitComment
public void visitComment(Comment comment)
Description copied from interface:IModelVisitorMethod for visiting a comment.- Specified by:
visitCommentin interfaceIModelVisitor- Parameters:
comment- the comment to visit
-
visitCompoundAccessStatement
public void visitCompoundAccessStatement(CompoundAccessStatement access)
Description copied from interface:IModelVisitorVisits a compound access statement (may occur in freeze blocks.- Specified by:
visitCompoundAccessStatementin interfaceIModelVisitor- Parameters:
access- the access statement
-
-