choco.cp.common.util.preprocessor
Class AbstractAdvancedDetector

java.lang.Object
  extended by choco.cp.common.util.preprocessor.AbstractDetector
      extended by choco.cp.common.util.preprocessor.AbstractAdvancedDetector
Direct Known Subclasses:
AbstractGraphBasedDetector, AbstractIntegerVariableEqualitiesDetector, AbstractRscDetector, AbstractTaskVariableEqualitiesDetector, AbstractTemporalDetector, ClauseFromDisjointModelDetector, ExpressionSolverDetector, PrecFromTimeWindowModelDetector, PrecReductionModelDetector, SymetryBreakingModelDetector

public abstract class AbstractAdvancedDetector
extends AbstractDetector

User : cprudhom
Mail : cprudhom(a)emn.fr
Date : 1 avr. 2010br/> Since : Choco 2.1.1
An abstract class to set the methods of a detector. A detector analyzes a model and thanks to its analizis, it is allowed to strongly modified the model involved.


Field Summary
protected  gnu.trove.TLongObjectHashMap<Constraint> constraintsToAdd
          Internal structure to store constraint addition instructions
protected  gnu.trove.TLongObjectHashMap<Constraint> constraintsToDelete
          Internal structure to store constraint deletion instructions
protected  gnu.trove.TLongObjectHashMap<Variable> variablesToAdd
          Internal structure to store variable addition instructions
protected  gnu.trove.TLongObjectHashMap<Variable> variablesToDelete
          Internal structure to store variable deletion instructions
protected  gnu.trove.THashMap<Variable,Variable> variablesToReplace
          Internal structure to store variable deletion instructions
 
Fields inherited from class choco.cp.common.util.preprocessor.AbstractDetector
LOGGER, model
 
Constructor Summary
protected AbstractAdvancedDetector(CPModel model)
           
 
Method Summary
protected  void add(Constraint c)
          Add a constraint c to the model which is currently treated by the detector.
protected  void add(Variable v)
          Add a variable v to the model which is currently treated by the detector.
abstract  void apply()
          Apply the detection defined within the detector.
 void commit()
          Send changes detected to the treated model.
protected  void delete(Constraint c)
          Delete a constraint c to the model which is currently treated by the detector.
protected  void delete(Variable v)
          Delete a variable v from the model which is currently treated by the detector.
protected  void forget(Constraint c)
          Remove addition instruction on c.
protected  void forget(Variable v)
          Remove addition instruction on v.
protected  void keep(Constraint c)
          Remove deletion instruction on c.
protected  void keep(Variable v)
          Remove deletion instruction on v.
protected  void replaceBy(Variable outVar, Variable inVar)
          Replace outVar by inVar in every constraint where outVar is involved.
 void rollback()
          Remove all uncommited instructions.
 
Methods inherited from class choco.cp.common.util.preprocessor.AbstractDetector
applyThenCommit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

constraintsToAdd

protected final gnu.trove.TLongObjectHashMap<Constraint> constraintsToAdd
Internal structure to store constraint addition instructions


constraintsToDelete

protected final gnu.trove.TLongObjectHashMap<Constraint> constraintsToDelete
Internal structure to store constraint deletion instructions


variablesToAdd

protected final gnu.trove.TLongObjectHashMap<Variable> variablesToAdd
Internal structure to store variable addition instructions


variablesToDelete

protected final gnu.trove.TLongObjectHashMap<Variable> variablesToDelete
Internal structure to store variable deletion instructions


variablesToReplace

protected final gnu.trove.THashMap<Variable,Variable> variablesToReplace
Internal structure to store variable deletion instructions

Constructor Detail

AbstractAdvancedDetector

protected AbstractAdvancedDetector(CPModel model)
Method Detail

apply

public abstract void apply()
Apply the detection defined within the detector.

Specified by:
apply in class AbstractDetector

add

protected final void add(Constraint c)
Add a constraint c to the model which is currently treated by the detector.
The addition is recorded but not done immediatly. It must be "commited" using commit().

Parameters:
c - contraint to add

delete

protected final void delete(Constraint c)
Delete a constraint c to the model which is currently treated by the detector.
The deletion is recorded but not done immediatly. It must be "commited" using commit().

Parameters:
c - contraint to delete

keep

protected final void keep(Constraint c)
Remove deletion instruction on c.

Parameters:
c - contraint to keep

forget

protected final void forget(Constraint c)
Remove addition instruction on c.

Parameters:
c - contraint to not add

add

protected final void add(Variable v)
Add a variable v to the model which is currently treated by the detector.
The addition is recorded but not done immediatly. It must be "commited" using commit().

Parameters:
v - variable to add

delete

protected final void delete(Variable v)
Delete a variable v from the model which is currently treated by the detector.
The deletion is recorded but not done immediatly. It must be "commited" using commit().

Parameters:
v - variable to delete

keep

protected final void keep(Variable v)
Remove deletion instruction on v.

Parameters:
v - variable to keep

forget

protected final void forget(Variable v)
Remove addition instruction on v.

Parameters:
v - contraint to not add

replaceBy

protected final void replaceBy(Variable outVar,
                               Variable inVar)
Replace outVar by inVar in every constraint where outVar is involved.

Parameters:
outVar - deleted variable
inVar - the substitute

commit

public final void commit()
Send changes detected to the treated model.

Specified by:
commit in class AbstractDetector

rollback

public final void rollback()
Remove all uncommited instructions.



Copyright © 2012. All Rights Reserved.