Package net.ssehub.easy.varModel.cst
Class ValidationVisitor
java.lang.Object
net.ssehub.easy.varModel.cst.ValidationVisitor
- All Implemented Interfaces:
IConstraintTreeVisitor
Visits a given expression and returns whether this is a valid assignment.
- Author:
- Holger Eichelberger
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intStores the number of assignments (to be derived while visiting a constraint tree). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the errors.getError(int index) Returns the specified error.intReturns the number of errors.Returns the errors as a comma separated string.booleanReturns whether the visited tree represents an assignment.booleanReturns whether the visited tree represents a valid assignment.voidreset()Resets this instance.voidvisitAnnotationVariable(AttributeVariable variable) Visits aAttributeVariable.voidVisits the block.voidvisitComment(Comment comment) Visits a comment.voidvisitCompoundAccess(CompoundAccess access) Visits a compound access node.voidvisitCompoundInitializer(CompoundInitializer initializer) Visits a compound initializer.voidvisitConstantValue(ConstantValue value) Visits a constant value.voidvisitContainerInitializer(ContainerInitializer initializer) Visits a container initializer.voidVisits a container operation call (e.g.voidvisitDeferInitExpression(DeferInitExpression expression) Visits a default init expression.voidvisitIfThen(IfThen ifThen) Visits an if-then-else expression.voidVisits a let expression.voidvisitMultiAndExpression(MultiAndExpression expression) Visits a multi-and expression.voidVisits an OCL feature call.voidvisitParenthesis(Parenthesis parenthesis) Visits a parenthesis.voidVisits self.voidvisitUnresolvedExpression(UnresolvedExpression expression) Visits an unresolved expression.voidvisitVariable(Variable variable) Visits a variable.
-
Field Details
-
assignmentCount
private int assignmentCountStores the number of assignments (to be derived while visiting a constraint tree). -
errors
-
-
Constructor Details
-
ValidationVisitor
public ValidationVisitor()Creates a new assignment check visitor.
-
-
Method Details
-
clear
public void clear()Clears the errors. -
getErrorCount
public int getErrorCount()Returns the number of errors.- Returns:
- the number of errors
-
getError
Returns the specified error.- Parameters:
index- the index of the error- Returns:
- the error
- Throws:
IndexOutOfBoundsException- ifindex < 0 || index >=getErrorCount()
-
getErrorString
Returns the errors as a comma separated string.- Returns:
- the errors as a comma separated string, an empty string if there are no errors
-
isAssignment
public boolean isAssignment()Returns whether the visited tree represents an assignment.- Returns:
trueif it is an assignment,falseelse
-
isValidAssignment
public boolean isValidAssignment()Returns whether the visited tree represents a valid assignment.- Returns:
trueif it is a valid assignment,falseelse
-
reset
public void reset()Resets this instance. -
visitConstantValue
Description copied from interface:IConstraintTreeVisitorVisits a constant value.- Specified by:
visitConstantValuein interfaceIConstraintTreeVisitor- Parameters:
value- the value which should be visited
-
visitVariable
Description copied from interface:IConstraintTreeVisitorVisits a variable.- Specified by:
visitVariablein interfaceIConstraintTreeVisitor- Parameters:
variable- the variable which should be visited
-
visitParenthesis
Description copied from interface:IConstraintTreeVisitorVisits a parenthesis.- Specified by:
visitParenthesisin interfaceIConstraintTreeVisitor- Parameters:
parenthesis- the parenthesis which should be visited
-
visitCompoundInitializer
Description copied from interface:IConstraintTreeVisitorVisits a compound initializer.- Specified by:
visitCompoundInitializerin interfaceIConstraintTreeVisitor- Parameters:
initializer- the compound initializer node
-
visitContainerInitializer
Description copied from interface:IConstraintTreeVisitorVisits a container initializer.- Specified by:
visitContainerInitializerin interfaceIConstraintTreeVisitor- Parameters:
initializer- the container initializer node
-
visitComment
Description copied from interface:IConstraintTreeVisitorVisits a comment.- Specified by:
visitCommentin interfaceIConstraintTreeVisitor- Parameters:
comment- the comment node which should be visited
-
visitOclFeatureCall
Description copied from interface:IConstraintTreeVisitorVisits an OCL feature call.- Specified by:
visitOclFeatureCallin interfaceIConstraintTreeVisitor- Parameters:
call- the feature call which should be visited
-
visitDeferInitExpression
Description copied from interface:IConstraintTreeVisitorVisits a default init expression.- Specified by:
visitDeferInitExpressionin interfaceIConstraintTreeVisitor- Parameters:
expression- the expression
-
visitMultiAndExpression
Description copied from interface:IConstraintTreeVisitorVisits a multi-and expression.- Specified by:
visitMultiAndExpressionin interfaceIConstraintTreeVisitor- Parameters:
expression- the expression to be visited
-
visitLet
Description copied from interface:IConstraintTreeVisitorVisits a let expression.- Specified by:
visitLetin interfaceIConstraintTreeVisitor- Parameters:
let- the let expression which should be visited
-
visitIfThen
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
Description copied from interface:IConstraintTreeVisitorVisits a container operation call (e.g. quantors, iterators).- Specified by:
visitContainerOperationCallin interfaceIConstraintTreeVisitor- Parameters:
call- the container operation call
-
visitCompoundAccess
Description copied from interface:IConstraintTreeVisitorVisits a compound access node.- Specified by:
visitCompoundAccessin interfaceIConstraintTreeVisitor- Parameters:
access- the compound access node
-
visitUnresolvedExpression
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
Description copied from interface:IConstraintTreeVisitorVisits self.- Specified by:
visitSelfin interfaceIConstraintTreeVisitor- Parameters:
self- the self object to visit
-
visitAnnotationVariable
Description copied from interface:IConstraintTreeVisitorVisits aAttributeVariable.- Specified by:
visitAnnotationVariablein interfaceIConstraintTreeVisitor- Parameters:
variable- the attribute variable which should be visited
-
visitBlockExpression
Description copied from interface:IConstraintTreeVisitorVisits the block.- Specified by:
visitBlockExpressionin interfaceIConstraintTreeVisitor- Parameters:
block- the block to be visited
-