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:
IConstraintTreeVisitor
public class VariablesInConstraintFinder extends AbstractStateVariablesInConstraintFinder
Searches for usedIDecisionVariables and their states inside aConstraintSyntaxTree. For reuse, callAbstractStateVariablesInConstraintFinder.setConfiguration(Configuration)first, then visit the respective constraint, call one of the getters to obtain the result, e.g.,isConstraintFrozen()and finallyclear().- Author:
- El-Sharkawy, Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private intfrozenVariablesCountprivate intlocalVariablesCountprivate intvariablesCount
-
Constructor Summary
Constructors Constructor Description VariablesInConstraintFinder()Creates a constraint finder for reuse.VariablesInConstraintFinder(ConstraintSyntaxTree cst, Configuration config)Creates a constraint finder for single use directly oncst.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddVariable(IDecisionVariable var)Adds the relatedIDecisionVariableand their state to the result.voidclear()Clears this visitor for reuse.intgetFrozenVariablesCount()Returns the number of frozen variables used in the visited constraint.intgetLocalVariablesCount()Returns the number of local variables used in the visited constraint.intgetVariablesCount()Returns the number of variables used in the visited constraint.booleanisConstraintFrozen()Returns 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, visitVariable
-
Methods inherited from class net.ssehub.easy.varModel.model.filter.AbstractVariableInConstraintFinder
visitBlockExpression, visitComment, visitCompoundInitializer, visitConstantValue, visitContainerInitializer, visitIfThen, visitMultiAndExpression, visitOclFeatureCall, visitParenthesis, visitSelf, visitUnresolvedExpression, visitValue
-
-
-
-
Constructor Detail
-
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(ConstraintSyntaxTree cst, 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 the cst belongs to (must not be null).
-
-
Method Detail
-
clear
public void clear()
Clears this visitor for reuse.- Overrides:
clearin classAbstractStateVariablesInConstraintFinder
-
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(IDecisionVariable var)
Description copied from class:AbstractStateVariablesInConstraintFinderAdds the relatedIDecisionVariableand their state to the result.- Specified by:
addVariablein classAbstractStateVariablesInConstraintFinder- Parameters:
var- the variable to be added, may be null, ignored then
-
-