Class BackwardPlan

java.lang.Object
edu.uky.ai.planning.BackwardPlan
All Implemented Interfaces:
Plan, Iterable<Step>

public class BackwardPlan extends Object implements Plan
A totally ordered plan which is built from end (last step) to beginning. In keeping with the contract of Iterable.iterator(), this plan's iterator still gives steps from first to last. Note that this data structure is immutable. The addStep(Step) method returns a new plan with the given step added to the beginning without modifying the plan on which that method was called.
Author:
Stephen G. Ware
  • Constructor Details

    • BackwardPlan

      public BackwardPlan()
      Constructs a new plan with 0 steps.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • size

      public int size()
      Description copied from interface: Plan
      Returns the number of steps in the plan.
      Specified by:
      size in interface Plan
      Returns:
      the number of steps
    • iterator

      public Iterator<Step> iterator()
      Specified by:
      iterator in interface Iterable<Step>
    • addStep

      public BackwardPlan addStep(Step step)
      Returns a new plan with the given step added at the beginning.
      Parameters:
      step - the first step to take
      Returns:
      a new plan whose first step is the given step