Class AssignmentDetector
- java.lang.Object
-
- de.uni_hildesheim.sse.translation.AssignmentDetector
-
- All Implemented Interfaces:
net.ssehub.easy.varModel.cst.IConstraintTreeVisitor
public class AssignmentDetector extends java.lang.Object implements net.ssehub.easy.varModel.cst.IConstraintTreeVisitorImplements a visitor which searches for assignments. Instances of this class may be reused by callingclear()after use.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanisAssignmentprivate intlevelstatic intLEVEL_UNLIMITEDThe level specification to be used if traversal shall not be limited.private intmaxLevelstatic intNO_DEEP_TRAVERSALThe level specification to be used if no deep traversal shall happen (just the top level).
-
Constructor Summary
Constructors Constructor Description AssignmentDetector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears this visitor for reuse.private booleancontinueTraversal()Returns whether the traversal of the given constraint shall be continued in case of nested trees.booleanisAssignment()Returns whether the expression is an assignment at maximum at the given level.voidsetMaxLevel(int level)Defines the maximum search level.voidvisitAnnotationVariable(net.ssehub.easy.varModel.cst.AttributeVariable variable)voidvisitBlockExpression(net.ssehub.easy.varModel.cst.BlockExpression block)voidvisitComment(net.ssehub.easy.varModel.cst.Comment comment)voidvisitCompoundAccess(net.ssehub.easy.varModel.cst.CompoundAccess access)voidvisitCompoundInitializer(net.ssehub.easy.varModel.cst.CompoundInitializer initializer)voidvisitConstantValue(net.ssehub.easy.varModel.cst.ConstantValue value)voidvisitContainerInitializer(net.ssehub.easy.varModel.cst.ContainerInitializer initializer)voidvisitContainerOperationCall(net.ssehub.easy.varModel.cst.ContainerOperationCall call)voidvisitDeferInitExpression(net.ssehub.easy.varModel.cst.DeferInitExpression expression)voidvisitIfThen(net.ssehub.easy.varModel.cst.IfThen ifThen)voidvisitLet(net.ssehub.easy.varModel.cst.Let let)voidvisitMultiAndExpression(net.ssehub.easy.varModel.cst.MultiAndExpression expression)voidvisitOclFeatureCall(net.ssehub.easy.varModel.cst.OCLFeatureCall call)voidvisitParenthesis(net.ssehub.easy.varModel.cst.Parenthesis parenthesis)voidvisitSelf(net.ssehub.easy.varModel.cst.Self self)voidvisitUnresolvedExpression(net.ssehub.easy.varModel.cst.UnresolvedExpression expression)voidvisitVariable(net.ssehub.easy.varModel.cst.Variable variable)
-
-
-
Field Detail
-
LEVEL_UNLIMITED
public static final int LEVEL_UNLIMITED
The level specification to be used if traversal shall not be limited.- See Also:
- Constant Field Values
-
NO_DEEP_TRAVERSAL
public static final int NO_DEEP_TRAVERSAL
The level specification to be used if no deep traversal shall happen (just the top level).- See Also:
- Constant Field Values
-
isAssignment
private boolean isAssignment
-
maxLevel
private int maxLevel
-
level
private int level
-
-
Method Detail
-
setMaxLevel
public void setMaxLevel(int level)
Defines the maximum search level.- Parameters:
level- the maximum search level, may beLEVEL_UNLIMITEDin order to avoid any level limitation orNO_DEEP_TRAVERSALin order to avoid
-
isAssignment
public boolean isAssignment()
Returns whether the expression is an assignment at maximum at the given level.- Returns:
trueif it is an assignment,falseelse
-
clear
public void clear()
Clears this visitor for reuse.
-
visitConstantValue
public void visitConstantValue(net.ssehub.easy.varModel.cst.ConstantValue value)
- Specified by:
visitConstantValuein interfacenet.ssehub.easy.varModel.cst.IConstraintTreeVisitor
-
visitVariable
public void visitVariable(net.ssehub.easy.varModel.cst.Variable variable)
- Specified by:
visitVariablein interfacenet.ssehub.easy.varModel.cst.IConstraintTreeVisitor
-
visitAnnotationVariable
public void visitAnnotationVariable(net.ssehub.easy.varModel.cst.AttributeVariable variable)
- Specified by:
visitAnnotationVariablein interfacenet.ssehub.easy.varModel.cst.IConstraintTreeVisitor
-
continueTraversal
private boolean continueTraversal()
Returns whether the traversal of the given constraint shall be continued in case of nested trees. Continuation is not needed if already an assignment has been found or the maximum level is exceeded.- Returns:
trueif the traversal shall be continued,falseelse
-
visitParenthesis
public void visitParenthesis(net.ssehub.easy.varModel.cst.Parenthesis parenthesis)
- Specified by:
visitParenthesisin interfacenet.ssehub.easy.varModel.cst.IConstraintTreeVisitor
-
visitComment
public void visitComment(net.ssehub.easy.varModel.cst.Comment comment)
- Specified by:
visitCommentin interfacenet.ssehub.easy.varModel.cst.IConstraintTreeVisitor
-
visitOclFeatureCall
public void visitOclFeatureCall(net.ssehub.easy.varModel.cst.OCLFeatureCall call)
- Specified by:
visitOclFeatureCallin interfacenet.ssehub.easy.varModel.cst.IConstraintTreeVisitor
-
visitDeferInitExpression
public void visitDeferInitExpression(net.ssehub.easy.varModel.cst.DeferInitExpression expression)
- Specified by:
visitDeferInitExpressionin interfacenet.ssehub.easy.varModel.cst.IConstraintTreeVisitor
-
visitMultiAndExpression
public void visitMultiAndExpression(net.ssehub.easy.varModel.cst.MultiAndExpression expression)
- Specified by:
visitMultiAndExpressionin interfacenet.ssehub.easy.varModel.cst.IConstraintTreeVisitor
-
visitLet
public void visitLet(net.ssehub.easy.varModel.cst.Let let)
- Specified by:
visitLetin interfacenet.ssehub.easy.varModel.cst.IConstraintTreeVisitor
-
visitIfThen
public void visitIfThen(net.ssehub.easy.varModel.cst.IfThen ifThen)
- Specified by:
visitIfThenin interfacenet.ssehub.easy.varModel.cst.IConstraintTreeVisitor
-
visitContainerOperationCall
public void visitContainerOperationCall(net.ssehub.easy.varModel.cst.ContainerOperationCall call)
- Specified by:
visitContainerOperationCallin interfacenet.ssehub.easy.varModel.cst.IConstraintTreeVisitor
-
visitCompoundAccess
public void visitCompoundAccess(net.ssehub.easy.varModel.cst.CompoundAccess access)
- Specified by:
visitCompoundAccessin interfacenet.ssehub.easy.varModel.cst.IConstraintTreeVisitor
-
visitUnresolvedExpression
public void visitUnresolvedExpression(net.ssehub.easy.varModel.cst.UnresolvedExpression expression)
- Specified by:
visitUnresolvedExpressionin interfacenet.ssehub.easy.varModel.cst.IConstraintTreeVisitor
-
visitCompoundInitializer
public void visitCompoundInitializer(net.ssehub.easy.varModel.cst.CompoundInitializer initializer)
- Specified by:
visitCompoundInitializerin interfacenet.ssehub.easy.varModel.cst.IConstraintTreeVisitor
-
visitContainerInitializer
public void visitContainerInitializer(net.ssehub.easy.varModel.cst.ContainerInitializer initializer)
- Specified by:
visitContainerInitializerin interfacenet.ssehub.easy.varModel.cst.IConstraintTreeVisitor
-
visitSelf
public void visitSelf(net.ssehub.easy.varModel.cst.Self self)
- Specified by:
visitSelfin interfacenet.ssehub.easy.varModel.cst.IConstraintTreeVisitor
-
visitBlockExpression
public void visitBlockExpression(net.ssehub.easy.varModel.cst.BlockExpression block)
- Specified by:
visitBlockExpressionin interfacenet.ssehub.easy.varModel.cst.IConstraintTreeVisitor
-
-