Class MandatoryDeclarationClassifier

java.lang.Object
net.ssehub.easy.varModel.model.AbstractProjectVisitor
net.ssehub.easy.varModel.model.filter.mandatoryVars.MandatoryDeclarationClassifier
All Implemented Interfaces:
IConstraintTreeVisitor, ICustomDatatypeVisitor, IModelVisitor

public class MandatoryDeclarationClassifier extends AbstractProjectVisitor implements IConstraintTreeVisitor
Heuristic classifier, which determines whether the variables of a Configuration should be changed by the user or not.

When is a variable mandatory?

  • There exist a constraint specifying that these variable must be defined (cf. OclKeyWords.IS_DEFINED)
  • The variable has no default value.

How to use:

  1. Call constructor with configuration
  2. Visit project of configuration
  3. Call getImportances()
  4. For each IDecisionVariable (even nested variables), the VariableContainer can be asked whether the variable is mandatory

For instance:

   IDecisionVariable variable ... // Variable to be tested
   MandatoryDeclarationClassifier finder = new MandatoryDeclarationClassifier(config, FilterType.ALL);
   project.accept(finder);
   VariableContainer importances = finder.getImportances();
   boolean isMandatory = importances.isMandatory(variable); // Result for variable
 
Author:
El-Sharkawy