Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.wpi.cetask
Class Plan

    java.lang.Object
      edu.wpi.cetask.Plan

    public class Plan

extends Object

Constructor Summary
`Plan(Task goal)`

Method Summary
`void` | `add(Plan plan)` Add given plan as child of this plan.
`void` | `apply(DecompositionClass type)`
`Iterator<Plan>` | `children()`
`void` | `decomposeAll()`
`void` | `execute()` System executes script for goal of this plan.
`List<Plan>` | `findMatches(Task task, boolean onlyLive)` Return list of plans in this plan tree whose goal matches given task.
`List<Plan>` | `findMatches(Task task, boolean onlyLive, Plan exclude)` Return list of plans in this plan tree whose goal matches given task.
`List<Plan>` | `getBlockers()`
`Decomposition` | `getDecomposition()`
`List<Plan>` | `getExpected()`
`Task` | `getGoal()`
`List<Plan>` | `getLive()` Return list of live children of this plan.
`List<Plan>` | `getLiveDescendants()` Return list of live descendants of this plan.
`List<Object>` | `getNotes()` Return list of notes to be added to verbose printing of this plan.
`Plan` | `getParent()`
`boolean` | `hasExpected()` Test whether this plan has immediate subplan which is expected.
`boolean` | `hasFailed()` Test whether this plan has any failed contributing children.
`boolean` | `hasLiveDescendants()` Test whether this plan has any live descendants.
`boolean` | `isAncestor(Plan plan)` Test whether given plan can be reached from this plan by following parents.
`boolean` | `isBlocked()`
`boolean` | `isComplete()` Tests whether this plan has been decomposed (either by applying a DecompositionClass or procedurally) and all the non-optional steps are done.
`boolean` | `isDecomposed()`
`boolean` | `isDescendant(Plan plan)` Test whether given plan can be reached from this plan by following children.
`boolean` | `isDone()` Tests whether plans which require this plan should become live.
`boolean` | `isExhausted()` Test whether this plan has any remaining steps that could be executed
`boolean` | `isExpected()` Tests whether this plan is or is expected to ever become live.
`boolean` | `isFailed()`
`boolean` | `isLive()`
`boolean` | `isMoot()` Tests whether this plan is incomplete, but does not need to be executed because all the reasons for doing it have already been achieved or are no longer desired.
`boolean` | `isOptional()`
`boolean` | `isPassed()`
`boolean` | `isPoppable()` Tests whether popping plan from the stack would would constitute an unnecessary focus shift.
`boolean` | `isRequired(Plan plan)`
`boolean` | `isStarted()`
`boolean` | `occurred()`
`Stack<Plan>` | `pathToDescendant(Plan plan)` Return path from this plan to given plan iff it is a descendant; otherwise null.
`void` | `print(PrintStream stream)`
`void` | `print(PrintStream stream, int indent, boolean recurse, boolean format)`
`void` | `recognize(Task task)` Recognize given task as matching this plan and copy slot values.
`void` | `remove(Plan child)` Remove given child of this plan.
`void` | `requires(Plan plan)`
`void` | `setDecomposed(boolean decomposed)`
`void` | `setOptional(boolean optional)`
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Plan

    public Plan(Task goal)

Method Detail

### getGoal

    public Task getGoal()

  Returns:
    the task which this plan is supposed to achieve

### getNotes

    public List<Object> getNotes()

  Return list of notes to be added to verbose printing of this plan. This is convenience feature for applications to manage by side effect.

  See Also:
    `print(PrintStream)`

### setOptional

    public void setOptional(boolean optional)

### isOptional

    public boolean isOptional()

### getParent

    public Plan getParent()

### isAncestor

    public boolean isAncestor(Plan plan)

  Test whether given plan can be reached from this plan by following parents. Note plan is not its own ancestor.

### isDescendant

    public boolean isDescendant(Plan plan)

  Test whether given plan can be reached from this plan by following children. Note plan is not its own descendant.

### pathToDescendant

    public Stack<Plan> pathToDescendant(Plan plan)

  Return path from this plan to given plan iff it is a descendant; otherwise null. Path does not include this plan or descendant and thus will be empty if given plan is child.

### children

    public Iterator<Plan> children()

  Returns:
    iterator for children of this plan.

### add

    public void add(Plan plan)

  Add given plan as child of this plan.

### remove

    public void remove(Plan child)

  Remove given child of this plan.

  Parameters:
    `child` - - must be child of this plan

### requires

    public void requires(Plan plan)

### isRequired

    public boolean isRequired(Plan plan)

### execute

    public void execute()

  System executes script for goal of this plan.

### occurred

    public boolean occurred()

### isDone

    public boolean isDone()

  Tests whether plans which require this plan should become live.

### isFailed

    public boolean isFailed()

### isLive

    public boolean isLive()

### isPoppable

    public boolean isPoppable()

  Tests whether popping plan from the stack would would constitute an unnecessary focus shift.

  Returns:
    true iff popping would not be an unnecessary focus shift.

### isComplete

    public boolean isComplete()

  Tests whether this plan has been decomposed (either by applying a DecompositionClass or procedurally) and all the non-optional steps are done. Note that even if this method returns true (and this plan is therefore done), it may still have optional ("trailing") children that are live.

  See Also:
    `isDecomposed()`, `isDone()`, `isPassed()`

### isPassed

    public boolean isPassed()

### isBlocked

    public boolean isBlocked()

### getBlockers

    public List<Plan> getBlockers()

### getLive

    public List<Plan> getLive()

  Return list of live children of this plan.

### getLiveDescendants

    public List<Plan> getLiveDescendants()

  Return list of live descendants of this plan.

### hasLiveDescendants

    public boolean hasLiveDescendants()

  Test whether this plan has any live descendants.

### hasFailed

    public boolean hasFailed()

  Test whether this plan has any failed contributing children.

### isStarted

    public boolean isStarted()

### isExhausted

    public boolean isExhausted()

  Test whether this plan has any remaining steps that could be executed

### isMoot

    public boolean isMoot()

  Tests whether this plan is incomplete, but does not need to be executed because all the reasons for doing it have already been achieved or are no longer desired. Currently, this means that there is an achieved or occurred plan looking "up" from this plan.

### isExpected

    public boolean isExpected()

  Tests whether this plan is or is expected to ever become live. For example, a plan which has been passed (required successor started) can never become live. Used mainly for status.

### hasExpected

    public boolean hasExpected()

  Test whether this plan has immediate subplan which is expected.

  See Also:
    `isExpected()`

### getExpected

    public List<Plan> getExpected()

### recognize

    public void recognize(Task task)

  Recognize given task as matching this plan and copy slot values. If given task is occurrence, then also check for failure (false postcondition) in ancestor plans.

### isDecomposed

    public boolean isDecomposed()

### setDecomposed

    public void setDecomposed(boolean decomposed)

### getDecomposition

    public Decomposition getDecomposition()

### apply

    public void apply(DecompositionClass type)

### decomposeAll

    public void decomposeAll()

### findMatches

    public List<Plan> findMatches(Task task,
                                  boolean onlyLive)

  Return list of plans in this plan tree whose goal matches given task.

  Parameters:
    `onlyLive` - only search live plans

### findMatches

    public List<Plan> findMatches(Task task,
                                  boolean onlyLive,
                                  Plan exclude)

  Return list of plans in this plan tree whose goal matches given task.

  Parameters:
    `onlyLive` - only search live plans
    `exclude` - do not search given plan

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### print

    public void print(PrintStream stream)

  See Also:
    `getNotes()`

### print

    public void print(PrintStream stream,
                      int indent,
                      boolean recurse,
                      boolean format)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD