Class CheckInitializerVisitor
- java.lang.Object
-
- net.ssehub.easy.varModel.model.values.ValueVisitorAdapter
-
- net.ssehub.easy.reasoning.sseReasoner.CheckInitializerVisitor
-
- All Implemented Interfaces:
IConstraintTreeVisitor,IValueVisitor
class CheckInitializerVisitor extends ValueVisitorAdapter implements IConstraintTreeVisitor
Visits constraints and checks for contained constraints for constraint variables. Call#accept(ContainerConstraintsFinder, IModelElement, IDecisionVariable)to use. This visitor is inherently reusable as instance.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private ConstraintSyntaxTreeexpressionprivate booleanisCompoundInitializerprivate IModelElementparentprivate booleanprocessprivate Resolverresolverprivate booleansubstituteVarsprivate Valuevalueprivate IDecisionVariablevariable
-
Constructor Summary
Constructors Constructor Description CheckInitializerVisitor(Resolver resolver)Creates the visitor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(ConstraintSyntaxTree cst, IModelElement parent, IDecisionVariable variable)Accepts the results of a container constraints finder and derives constraints from the contained constraints / constraint values.private voidcheckForConstraint(IDatatype type, ConstraintSyntaxTree cst)Checks for a constraint expression.private voidcreateConstraintFromValue(Value value)Creates a constraint from a value.voidvisitAnnotationVariable(AttributeVariable variable)Visits aAttributeVariable.voidvisitBlockExpression(BlockExpression block)Visits the block.voidvisitBooleanValue(BooleanValue value)This method is used for visiting BooleanValue.voidvisitComment(Comment comment)Visits a comment.voidvisitCompoundAccess(CompoundAccess access)Visits a compound access node.voidvisitCompoundInitializer(CompoundInitializer compoundInit)Visits a compound initializer.voidvisitCompoundValue(CompoundValue value)This method is used for visiting CompoundValue.voidvisitConstantValue(ConstantValue value)Visits a constant value.voidvisitConstraintValue(ConstraintValue value)This method is used for visiting ConstraintValue.voidvisitContainerInitializer(ContainerInitializer containerInit)Visits a container initializer.voidvisitContainerOperationCall(ContainerOperationCall call)Visits a container operation call (e.g.voidvisitContainerValue(ContainerValue value)This method is used for visiting ContainerValue.voidvisitIfThen(IfThen ifThen)Visits an if-then-else expression.voidvisitLet(Let let)Visits a let expression.voidvisitMultiAndExpression(MultiAndExpression expression)Visits a multi-and expression.voidvisitOclFeatureCall(OCLFeatureCall call)Visits an OCL feature call.voidvisitParenthesis(Parenthesis parenthesis)Visits a parenthesis.voidvisitSelf(Self self)Visits self.voidvisitUnresolvedExpression(UnresolvedExpression expression)Visits an unresolved expression.voidvisitVariable(Variable variable)Visits a variable.-
Methods inherited from class net.ssehub.easy.varModel.model.values.ValueVisitorAdapter
visitEnumValue, visitIntValue, visitMetaTypeValue, visitNullValue, visitRealValue, visitReferenceValue, visitStringValue, visitVersionValue
-
-
-
-
Field Detail
-
resolver
private Resolver resolver
-
isCompoundInitializer
private boolean isCompoundInitializer
-
expression
private ConstraintSyntaxTree expression
-
value
private Value value
-
process
private boolean process
-
variable
private IDecisionVariable variable
-
parent
private IModelElement parent
-
substituteVars
private boolean substituteVars
-
-
Constructor Detail
-
CheckInitializerVisitor
public CheckInitializerVisitor(Resolver resolver)
Creates the visitor.- Parameters:
resolver- the resolver instance to use for transforming and adding constraints
-
-
Method Detail
-
accept
public void accept(ConstraintSyntaxTree cst, IModelElement parent, IDecisionVariable variable)
Accepts the results of a container constraints finder and derives constraints from the contained constraints / constraint values.- Parameters:
cst- the constraint to accept / visitparent- parent for temporary constraintsvariable- the actually (nested) variable, used to relate the created constraint to, may be null
-
visitCompoundValue
public void visitCompoundValue(CompoundValue value)
Description copied from interface:IValueVisitorThis method is used for visiting CompoundValue.- Specified by:
visitCompoundValuein interfaceIValueVisitor- Overrides:
visitCompoundValuein classValueVisitorAdapter- Parameters:
value- One CompoundValue which should be visited.
-
visitContainerValue
public void visitContainerValue(ContainerValue value)
Description copied from interface:IValueVisitorThis method is used for visiting ContainerValue.- Specified by:
visitContainerValuein interfaceIValueVisitor- Overrides:
visitContainerValuein classValueVisitorAdapter- Parameters:
value- One CompoundValue which should be visited.
-
visitConstraintValue
public void visitConstraintValue(ConstraintValue value)
Description copied from interface:IValueVisitorThis method is used for visiting ConstraintValue.- Specified by:
visitConstraintValuein interfaceIValueVisitor- Overrides:
visitConstraintValuein classValueVisitorAdapter- Parameters:
value- One ConstraintValue which should be visited.
-
visitBooleanValue
public void visitBooleanValue(BooleanValue value)
Description copied from interface:IValueVisitorThis method is used for visiting BooleanValue.- Specified by:
visitBooleanValuein interfaceIValueVisitor- Overrides:
visitBooleanValuein classValueVisitorAdapter- Parameters:
value- One BooleanValue which should be visited.
-
createConstraintFromValue
private void createConstraintFromValue(Value value)
Creates a constraint from a value.- Parameters:
value- the value
-
visitCompoundInitializer
public void visitCompoundInitializer(CompoundInitializer compoundInit)
Description copied from interface:IConstraintTreeVisitorVisits a compound initializer.- Specified by:
visitCompoundInitializerin interfaceIConstraintTreeVisitor- Parameters:
compoundInit- the compound initializer node
-
visitContainerInitializer
public void visitContainerInitializer(ContainerInitializer containerInit)
Description copied from interface:IConstraintTreeVisitorVisits a container initializer.- Specified by:
visitContainerInitializerin interfaceIConstraintTreeVisitor- Parameters:
containerInit- the container initializer node
-
checkForConstraint
private void checkForConstraint(IDatatype type, ConstraintSyntaxTree cst)
Checks for a constraint expression. ConsiderssubstituteVars.- Parameters:
type- the actual data typecst- the constraint expression
-
visitConstantValue
public void visitConstantValue(ConstantValue value)
Description copied from interface:IConstraintTreeVisitorVisits a constant value.- Specified by:
visitConstantValuein interfaceIConstraintTreeVisitor- Parameters:
value- the value which should be visited
-
visitVariable
public void visitVariable(Variable variable)
Description copied from interface:IConstraintTreeVisitorVisits a variable.- Specified by:
visitVariablein interfaceIConstraintTreeVisitor- Parameters:
variable- the variable which should be visited
-
visitAnnotationVariable
public void visitAnnotationVariable(AttributeVariable variable)
Description copied from interface:IConstraintTreeVisitorVisits aAttributeVariable.- Specified by:
visitAnnotationVariablein interfaceIConstraintTreeVisitor- Parameters:
variable- the attribute variable which should be visited
-
visitParenthesis
public void visitParenthesis(Parenthesis parenthesis)
Description copied from interface:IConstraintTreeVisitorVisits a parenthesis.- Specified by:
visitParenthesisin interfaceIConstraintTreeVisitor- Parameters:
parenthesis- the parenthesis which should be visited
-
visitComment
public void visitComment(Comment comment)
Description copied from interface:IConstraintTreeVisitorVisits a comment.- Specified by:
visitCommentin interfaceIConstraintTreeVisitor- Parameters:
comment- the comment node which should be visited
-
visitOclFeatureCall
public void visitOclFeatureCall(OCLFeatureCall call)
Description copied from interface:IConstraintTreeVisitorVisits an OCL feature call.- Specified by:
visitOclFeatureCallin interfaceIConstraintTreeVisitor- Parameters:
call- the feature call which should be visited
-
visitLet
public void visitLet(Let let)
Description copied from interface:IConstraintTreeVisitorVisits a let expression.- Specified by:
visitLetin interfaceIConstraintTreeVisitor- Parameters:
let- the let expression which should be visited
-
visitIfThen
public void visitIfThen(IfThen ifThen)
Description copied from interface:IConstraintTreeVisitorVisits an if-then-else expression.- Specified by:
visitIfThenin interfaceIConstraintTreeVisitor- Parameters:
ifThen- the if-then-else expression which should be visited
-
visitContainerOperationCall
public void visitContainerOperationCall(ContainerOperationCall call)
Description copied from interface:IConstraintTreeVisitorVisits a container operation call (e.g. quantors, iterators).- Specified by:
visitContainerOperationCallin interfaceIConstraintTreeVisitor- Parameters:
call- the container operation call
-
visitCompoundAccess
public void visitCompoundAccess(CompoundAccess access)
Description copied from interface:IConstraintTreeVisitorVisits a compound access node.- Specified by:
visitCompoundAccessin interfaceIConstraintTreeVisitor- Parameters:
access- the compound access node
-
visitUnresolvedExpression
public void visitUnresolvedExpression(UnresolvedExpression expression)
Description copied from interface:IConstraintTreeVisitorVisits an unresolved expression. Please note that an unresolved expression may represent a leaf as well as an inner tree node. Typically, visitors shall continue visiting transparently atUnresolvedExpression.getActualExpression().- Specified by:
visitUnresolvedExpressionin interfaceIConstraintTreeVisitor- Parameters:
expression- the expression
-
visitSelf
public void visitSelf(Self self)
Description copied from interface:IConstraintTreeVisitorVisits self.- Specified by:
visitSelfin interfaceIConstraintTreeVisitor- Parameters:
self- the self object to visit
-
visitBlockExpression
public void visitBlockExpression(BlockExpression block)
Description copied from interface:IConstraintTreeVisitorVisits the block.- Specified by:
visitBlockExpressionin interfaceIConstraintTreeVisitor- Parameters:
block- the block to be visited
-
visitMultiAndExpression
public void visitMultiAndExpression(MultiAndExpression expression)
Description copied from interface:IConstraintTreeVisitorVisits a multi-and expression.- Specified by:
visitMultiAndExpressionin interfaceIConstraintTreeVisitor- Parameters:
expression- the expression to be visited
-
-