ix.iplan
Class FilteredPlanner

java.lang.Object
  extended by ix.iplan.FilteredPlanner
All Implemented Interfaces:
Planner

public class FilteredPlanner
extends java.lang.Object
implements Planner

A Planner that returns only plans that pass a filter. The filter is a Predicate1 that should return true for a plan that should be returned and false for one that should not. The predicate is allowed to have "state" and so may not always return the same value for the same plan. That lets filtering be used for such things as eliminating duplicate plans.


Field Summary
protected  Predicate1 filter
           
protected  boolean filterPlans
           
protected  Plan plan
           
protected  Planner planner
           
 
Constructor Summary
FilteredPlanner(Planner planner, Predicate1 filter)
           
 
Method Summary
 Plan getPlan()
          Returns this planner's current plan.
 PlanStats getStatistics()
          Returns statistics gathered by the most recent Planner.plan() or Planner.replan().
 void loadPlan(Plan plan)
          Adds the contents of the specified plan to this planner's current plan.
 void plan()
          Finds a plan that is a completion of this planner's current plan and makes it the new current plan.
 void replan()
          Finds the next in a series of plans that are completions of the plan that was current when Planner.plan() was most recently called.
 void setDomain(Domain domain)
          Sets this planner's domain.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

planner

protected Planner planner

filter

protected Predicate1 filter

filterPlans

protected boolean filterPlans

plan

protected Plan plan
Constructor Detail

FilteredPlanner

public FilteredPlanner(Planner planner,
                       Predicate1 filter)
Method Detail

setDomain

public void setDomain(Domain domain)
Description copied from interface: Planner
Sets this planner's domain. This is normally done before plan() or replan() are called. The consequences of calling this method at other times are unspecified.

Specified by:
setDomain in interface Planner

loadPlan

public void loadPlan(Plan plan)
Description copied from interface: Planner
Adds the contents of the specified plan to this planner's current plan. This is normally done before plan() or replan() are called. If it is done later, it should be followed by a call to plan() rather than to replan(). The consequences of calling this method at other times are unspecified.

Specified by:
loadPlan in interface Planner

plan

public void plan()
Description copied from interface: Planner
Finds a plan that is a completion of this planner's current plan and makes it the new current plan. The precise meaning of "completion" depends on the planner in question, but typically it will mean that all activities in the initial plan that might be expanded into subactions, using refinements in this planner's domain, will be expanded, and that all constraints in the initial plan or introduced by expansion would be satisfied if the plan were executed in a way that respected all of the ordering constraints. (Here, the initial plan is the plan that was current when plan() was called.)

A successful call to plan() leaves this planner in a state in which Planner.replan() can be called.

Specified by:
plan in interface Planner

replan

public void replan()
Description copied from interface: Planner
Finds the next in a series of plans that are completions of the plan that was current when Planner.plan() was most recently called. That completion then becomes the new current plan. You can think of this as reconsidering some choice made when producing earlier plans in the sequence and making different decision at that point. However, it is not guaranteed that the plan found in this way will be interestingly different from all of the earlier plans in the sequence.

The replan() method should not be called if plan() has not been called or if this planner has thrown an exception.

A successful call to replan() leaves this planner in a state in which Planner.replan() can be called again. plan() may be called instead, but this will begin a new sequence of plans based on this planner's now current plan, rather than on the plan that was the base for the previous sequence.

Specified by:
replan in interface Planner

getPlan

public Plan getPlan()
Description copied from interface: Planner
Returns this planner's current plan. This value is well-defined only if this planner has not thrown an exception.

Specified by:
getPlan in interface Planner

getStatistics

public PlanStats getStatistics()
Description copied from interface: Planner
Returns statistics gathered by the most recent Planner.plan() or Planner.replan().

Specified by:
getStatistics in interface Planner