Class VariablesInConstraintFinder
java.lang.Object
net.ssehub.easy.varModel.model.filter.AbstractVariableInConstraintFinder
net.ssehub.easy.varModel.model.filter.AbstractStateVariablesInConstraintFinder
net.ssehub.easy.reasoning.sseReasoner.model.VariablesInConstraintFinder
- All Implemented Interfaces:
net.ssehub.easy.varModel.cst.IConstraintTreeVisitor
public class VariablesInConstraintFinder
extends net.ssehub.easy.varModel.model.filter.AbstractStateVariablesInConstraintFinder
Searches for used
IDecisionVariables and their states inside a ConstraintSyntaxTree. For reuse,
call AbstractStateVariablesInConstraintFinder.setConfiguration(Configuration) first, then visit the respective constraint, call one of the getters
to obtain the result, e.g., isConstraintFrozen() and finally clear().- Author:
- El-Sharkawy, Holger Eichelberger
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate intprivate int -
Constructor Summary
ConstructorsConstructorDescriptionCreates a constraint finder for reuse.VariablesInConstraintFinder(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cst, net.ssehub.easy.varModel.confModel.Configuration config) Creates a constraint finder for single use directly oncst. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddVariable(net.ssehub.easy.varModel.confModel.IDecisionVariable var) voidclear()Clears this visitor for reuse.intReturns the number of frozen variables used in the visited constraint.intReturns the number of local variables used in the visited constraint.intReturns the number of variables used in the visited constraint.booleanReturns whether there are onlylocal variablesandfrozen variablesin the visited constraint.Methods inherited from class net.ssehub.easy.varModel.model.filter.AbstractStateVariablesInConstraintFinder
addVariable, getConfiguration, getEvaluator, setConfiguration, visitAnnotationVariable, visitCompoundAccess, visitContainerOperationCall, visitLet, visitVariableMethods inherited from class net.ssehub.easy.varModel.model.filter.AbstractVariableInConstraintFinder
visitBlockExpression, visitComment, visitCompoundInitializer, visitConstantValue, visitContainerInitializer, visitDeferInitExpression, visitIfThen, visitMultiAndExpression, visitOclFeatureCall, visitParenthesis, visitSelf, visitUnresolvedExpression, visitValue
-
Field Details
-
variablesCount
private int variablesCount -
frozenVariablesCount
private int frozenVariablesCount -
localVariablesCount
private int localVariablesCount
-
-
Constructor Details
-
VariablesInConstraintFinder
public VariablesInConstraintFinder()Creates a constraint finder for reuse. CallAbstractStateVariablesInConstraintFinder.setConfiguration(Configuration)first, accept then the constraint to be analyzed and callclear()afterwards to make the visitor instance ready for reuse. -
VariablesInConstraintFinder
public VariablesInConstraintFinder(net.ssehub.easy.varModel.cst.ConstraintSyntaxTree cst, net.ssehub.easy.varModel.confModel.Configuration config) Creates a constraint finder for single use directly oncst.- Parameters:
cst- A constraint where all nestedIDecisionVariable's should be found.config- The related Configuration of the project to where thecstbelongs to (must not be null).
-
-
Method Details
-
clear
public void clear()Clears this visitor for reuse.- Overrides:
clearin classnet.ssehub.easy.varModel.model.filter.AbstractStateVariablesInConstraintFinder
-
getFrozenVariablesCount
public int getFrozenVariablesCount()Returns the number of frozen variables used in the visited constraint.- Returns:
- the number of variables
-
getLocalVariablesCount
public int getLocalVariablesCount()Returns the number of local variables used in the visited constraint.- Returns:
- the number of variables
-
getVariablesCount
public int getVariablesCount()Returns the number of variables used in the visited constraint.- Returns:
- the number of variables
-
isConstraintFrozen
public boolean isConstraintFrozen()Returns whether there are onlylocal variablesandfrozen variablesin the visited constraint.- Returns:
truefor a frozen constraint,falseelse
-
addVariable
protected void addVariable(net.ssehub.easy.varModel.confModel.IDecisionVariable var) - Specified by:
addVariablein classnet.ssehub.easy.varModel.model.filter.AbstractStateVariablesInConstraintFinder
-