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

    Fields
    Modifier and Type
    Field
    Description
    private int
     
    private int
     
    private int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates 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 on cst.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addVariable(net.ssehub.easy.varModel.confModel.IDecisionVariable var)
     
    void
    Clears this visitor for reuse.
    int
    Returns the number of frozen variables used in the visited constraint.
    int
    Returns the number of local variables used in the visited constraint.
    int
    Returns the number of variables used in the visited constraint.
    boolean
    Returns whether there are only local variables and frozen variables in 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, visitDeferInitExpression, visitIfThen, visitMultiAndExpression, visitOclFeatureCall, visitParenthesis, visitSelf, visitUnresolvedExpression, visitValue

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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. Call AbstractStateVariablesInConstraintFinder.setConfiguration(Configuration) first, accept then the constraint to be analyzed and call clear() 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 on cst.
      Parameters:
      cst - A constraint where all nested IDecisionVariable's should be found.
      config - The related Configuration of the project to where the cst belongs to (must not be null).
  • Method Details

    • clear

      public void clear()
      Clears this visitor for reuse.
      Overrides:
      clear in class net.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 only local variables and frozen variables in the visited constraint.
      Returns:
      true for a frozen constraint, false else
    • addVariable

      protected void addVariable(net.ssehub.easy.varModel.confModel.IDecisionVariable var)
      Specified by:
      addVariable in class net.ssehub.easy.varModel.model.filter.AbstractStateVariablesInConstraintFinder