public final class BackTrackingManager
extends java.lang.Object
ChoicePoints that can occur during the
 evaluation of a feature term, taking care of the different branches offered
 by the points, and that is able to systematically explore the resulting
 search space and enumerate all resulting rule applications.
 ChoicePoints have to register themselves (using method
 passChoicePoint) each time they are invoked during evaluation
 of the feature term, and are asked by the manager for their branches. The
 manager simulates a backtracking behaviour by repeated evaluation of the
 feature term.| Modifier and Type | Field and Description | 
|---|---|
private java.util.Stack<java.util.Iterator<CPBranch>> | 
choices
Stack of  
Iterator: the branches of
 ChoicePoints that have not yet been taken, the branches
 of later points being further up in the stack | 
private java.util.ArrayList<CPBranch> | 
chosenBranches
List of  
CPBranch: the branches that are taken in the
 current evaluation run | 
private RuleApp | 
initialApp
The original rule application in question, i.e., the application without
 the changes that can possibly be applied by  
ChoicePoints | 
private int | 
position
The position within  
choices during the current evaluation
 run (the number of ChoicePoints that occured so far
 during the current evaluation) | 
private java.util.ArrayList<java.lang.Object> | 
tickets
List of  
Object: each ChoicePoint has to
 install a ticket, which is used as a sanity check when the evaluation of
 a feature term is repeated. | 
| Constructor and Description | 
|---|
BackTrackingManager()  | 
| Modifier and Type | Method and Description | 
|---|---|
private void | 
addChoicePoint(ChoicePoint cp)  | 
private void | 
assertValidTicket(java.lang.Object ticket)  | 
boolean | 
backtrack()
In the end of an evaluation run of a feature term, this method has to be
 called for checking whether it is possible to backtrack and whether a
 further evaluation run is necessary 
 | 
private void | 
cancelChoicePoint()  | 
private RuleApp | 
getOldRuleApp()  | 
RuleApp | 
getResultingapp()  | 
void | 
passChoicePoint(ChoicePoint cp,
               java.lang.Object ticket)
Method that has to be invoked by each feature that represents a choice
 point, each time the feature is invoked during evaluation of the feature
 term 
 | 
private void | 
pushChoices(java.util.Iterator<CPBranch> remainingChoices,
           CPBranch chosen)  | 
void | 
setup(RuleApp initialApp)
Method that has to be called before a sequence of evaluation runs of a
 feature term. 
 | 
private RuleApp initialApp
ChoicePointsprivate final java.util.Stack<java.util.Iterator<CPBranch>> choices
Iterator: the branches of
 ChoicePoints that have not yet been taken, the branches
 of later points being further up in the stackprivate final java.util.ArrayList<CPBranch> chosenBranches
CPBranch: the branches that are taken in the
 current evaluation runprivate int position
choices during the current evaluation
 run (the number of ChoicePoints that occured so far
 during the current evaluation)private final java.util.ArrayList<java.lang.Object> tickets
Object: each ChoicePoint has to
 install a ticket, which is used as a sanity check when the evaluation of
 a feature term is repeated. This is a simple runtime measure for ensuring
 that the feature evaluation is deterministicpublic void passChoicePoint(ChoicePoint cp, java.lang.Object ticket)
cp - the ChoicePoint in question (which does not
            have to be the same object as the feature, and which does not
            have to be the same object over different evaluations of the
            feature term)ticket - a unique object (as unique as possible) that has to be
            provided by the feature in order to ensure that the same
            sequence of choice points occurs during the next evaluation
            run (after backtracking). The ticket must not
            change between two evaluation runs of the feature termpublic void setup(RuleApp initialApp)
initialApp - the original rule application in questionpublic boolean backtrack()
true iff there are paths left to explore, i.e., if
         evaluation should run a further timepublic RuleApp getResultingapp()
private void pushChoices(java.util.Iterator<CPBranch> remainingChoices, CPBranch chosen)
private void addChoicePoint(ChoicePoint cp)
private void cancelChoicePoint()
private void assertValidTicket(java.lang.Object ticket)
private RuleApp getOldRuleApp()