public class QueueRuleApplicationManager extends java.lang.Object implements AutomatedRuleApplicationManager
AutomatedRuleApplicationManager that stores
 possible RuleApps in a priority queue. The element with highest
 priority in the queue can be obtained via next(). This operation
 will remove the element from the queue. The priority of a given
 RuleApp corresponds to its RuleAppCost. A RuleApp can
 be equipped with a RuleAppCost by converting it into a
 RuleAppContainer. The cost of a RuleApp is computed according
 to a given Strategy (see
 Feature.computeCost(RuleApp, PosInOccurrence, Goal)).| Modifier and Type | Field and Description | 
|---|---|
private Goal | 
goal
The goal this manager belongs to. 
 | 
private RuleApp | 
nextRuleApp
The next automatic  
RuleApp determined by the strategy. | 
private long | 
nextRuleTime  | 
private RuleAppContainer | 
previousMinimum
The minimum  
RuleAppContainer from a previous round. | 
private ImmutableHeap<RuleAppContainer> | 
queue
Priority queue containing all  
RuleAppContainers that are candidates
 for application on a Goal. | 
| Constructor and Description | 
|---|
QueueRuleApplicationManager()  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
clearCache()
Clear the heap of applicable rules 
 | 
private void | 
clearNextRuleApp()  | 
java.lang.Object | 
clone()  | 
private void | 
computeNextRuleApp(ImmutableHeap<RuleAppContainer> furtherAppsQueue)
Helper method for  
peekNext(). | 
AutomatedRuleApplicationManager | 
copy()  | 
private void | 
ensureQueueExists()
Add all rules to the heap that are not reported via the
  
RuleListener connection | 
RuleApp | 
next()  | 
RuleApp | 
peekNext()  | 
private ImmutableHeap<RuleAppContainer> | 
push(java.util.Iterator<RuleAppContainer> it,
    ImmutableHeap<RuleAppContainer> sourceQueue)
Add a number of new rule apps to the heap 
 | 
private ImmutableHeap<RuleAppContainer> | 
push(RuleAppContainer c,
    ImmutableHeap<RuleAppContainer> sourceQueue)
Add a new rule app to the heap, provided that the rule app is not
 infinitely expensive 
 | 
void | 
ruleAdded(RuleApp rule,
         PosInOccurrence pos)
Implementation of the method from  
NewRuleListener. | 
void | 
rulesAdded(ImmutableList<? extends RuleApp> rules,
          PosInOccurrence pos)
Implementation of the method from  
NewRuleListener. | 
void | 
setGoal(Goal p_goal)
Set the goal  
this is the rule app manager for | 
private Goal goal
private ImmutableHeap<RuleAppContainer> queue
RuleAppContainers that are candidates
 for application on a Goal.private RuleAppContainer previousMinimum
RuleAppContainer from a previous round. It is taken
 out of queue temporarily and is put back in during the next round. After
 all, the corresponding rule still needs to be taken into consideration
 for future rule applications.private RuleApp nextRuleApp
private long nextRuleTime
public void setGoal(Goal p_goal)
AutomatedRuleApplicationManagerthis is the rule app manager forsetGoal in interface AutomatedRuleApplicationManagerpublic void clearCache()
clearCache in interface AutomatedRuleApplicationManagerprivate void ensureQueueExists()
RuleListener connectionpublic void ruleAdded(RuleApp rule, PosInOccurrence pos)
NewRuleListener. The new
 rule app is added to the heapruleAdded in interface NewRuleListenerpublic void rulesAdded(ImmutableList<? extends RuleApp> rules, PosInOccurrence pos)
NewRuleListener. The new
 rule app is added to the heaprulesAdded in interface NewRuleListenerprivate ImmutableHeap<RuleAppContainer> push(java.util.Iterator<RuleAppContainer> it, ImmutableHeap<RuleAppContainer> sourceQueue)
private ImmutableHeap<RuleAppContainer> push(RuleAppContainer c, ImmutableHeap<RuleAppContainer> sourceQueue)
public RuleApp peekNext()
peekNext in interface AutomatedRuleApplicationManagerpublic RuleApp next()
next in interface AutomatedRuleApplicationManagerprivate void clearNextRuleApp()
private void computeNextRuleApp(ImmutableHeap<RuleAppContainer> furtherAppsQueue)
peekNext(). Searches for the next rule
 application, at which the iteration includes all rule app containers that
 are contained either in primary or secondary queue.public AutomatedRuleApplicationManager copy()
copy in interface AutomatedRuleApplicationManagerpublic java.lang.Object clone()
clone in class java.lang.Object