Class SimpleSolutionManager
java.lang.Object
fr.inria.rules.integraal.query_evaluation.conjunction.backtrack.legacy.SimpleSolutionManager
- All Implemented Interfaces:
SolutionManager
First simple implementation of the
SolutionManager using maps to
index results.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SubstitutionStore the current solutionprotected Predicate<Substitution> Predicate used to discard substitutions that should not be explored.protected final SubstitutionInitial substitution that must always be preserved in current solutions.protected final Map<Integer, Iterator<Substitution>> Index solutions by levelprotected final Map<Integer, Collection<Variable>> Index assigned variables by level -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new solution manager with default objectsSimpleSolutionManager(Substitution initialSubstitution) Creates a new solution manager with default objects -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int level, Iterator<Substitution> results) Adds new results for the given level.//////////////////////////////////////////////booleannext(int level) Try to use the next solution for the given level.protected Collection<Variable> variablesBeforeLevel(int level) Returns the variables assigned before the supplied level.
-
Field Details
-
substitutionsByLevel
Index solutions by level -
initialSubstitution
Initial substitution that must always be preserved in current solutions. -
variableByLevel
Index assigned variables by level -
currentSubstitution
Store the current solution -
filterSubstitution
Predicate used to discard substitutions that should not be explored.
-
-
Constructor Details
-
SimpleSolutionManager
public SimpleSolutionManager()Creates a new solution manager with default objects -
SimpleSolutionManager
Creates a new solution manager with default objects- Parameters:
initialSubstitution- the substitution to merge into every current solution
-
-
Method Details
-
getCurrentSolution
//////////////////////////////////////////////- Specified by:
getCurrentSolutionin interfaceSolutionManager- Returns:
- the current solution.
-
next
public boolean next(int level) Try to use the next solution for the given level. Recursively iterate over the solutions for the given level if needed.- Specified by:
nextin interfaceSolutionManager- Parameters:
level- the current level- Returns:
- true iff there is a next solution for this level
-
add
Adds new results for the given level.- Specified by:
addin interfaceSolutionManager- Parameters:
level- The level to add results toresults- An iterator of substitutions to add
-
variablesBeforeLevel
Returns the variables assigned before the supplied level.- Parameters:
level- the backtrack level- Returns:
- a collection of variables assigned before the given level
-