public class WerkzProject
extends java.lang.Object
Goal manager.
It is not strictly necessary to maintain a Goal
graph, it does assist in organizing and administering a
group of Goals.
Goal| Constructor and Description |
|---|
WerkzProject()
Construct.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addGoal(Goal goal)
Add a
Goal to this manager. |
void |
attainGoal(java.lang.String name)
Attempt to attain the specified goal.
|
void |
attainGoal(java.lang.String name,
Session session)
Attempt to attain the specified goal.
|
Goal |
getDefaultGoal()
Retrieve the default goal.
|
java.lang.String |
getDefaultGoalName()
Retrieve the default goal name.
|
Goal[] |
getExecutionChain(java.lang.String name)
Retrieve a valid execution chain to attain the specified goal.
|
Goal |
getGoal(java.lang.String name)
Retrieve a
Goal by name from this manager. |
Goal |
getGoal(java.lang.String name,
boolean create)
Retrieve a
Goal by name from this manager. |
java.util.Collection |
getGoals()
Retrieve an unmodifiable collection of all
Goals
that are a part of this Project. |
void |
percolateGoal(java.lang.String name)
Attempt to percolate the specified goal.
|
void |
percolateGoal(java.lang.String name,
Session session)
Attempt to percolate the specified goal.
|
void |
removeGoal(java.lang.String name) |
void |
setDefaultGoalName(java.lang.String defaultGoalName)
Set the default goal name.
|
java.lang.String |
toString()
Produce a textual representation suitable for debugging.
|
public Goal[] getExecutionChain(java.lang.String name) throws NoSuchGoalException
This method returns one of possibly many different valid execution chains. All chains will be of the same length. This implementation happens to perform a breadth-first walk, so the chain will grow from the deepest sections to the showllowest instead of plunging/surging upwards.
B - D
/ \
A F
\ /
C - E
will result in either FEDCBA or FDEBCA but will
not result in the equally valid FECDBA or FDBECA
sequences.
The ordering of the array is such that the index
length - 1 (the last index of the array)
points to the Goal specified as the
parameter to the method.
name - The name of the goal.NoSuchGoalException - if the name refers to no known goal.public void attainGoal(java.lang.String name,
Session session)
throws NoSuchGoalException,
UnattainableGoalException,
NoActionDefinitionException
name - The name of the goal to attain.session - The context in which to attain goals.NoSuchGoalException - if the name refers to no known goal.UnattainableGoalException - if a precursor or the goal itself had an error.NoActionDefinitionException - if a goal contains no action definition.public void percolateGoal(java.lang.String name,
Session session)
throws NoSuchGoalException,
UnattainableGoalException,
NoActionDefinitionException
name - The name of the goal to percolate.session - The context in which to percolate goals.NoSuchGoalException - if the name refers to no known goal.UnattainableGoalException - if a postcursor or the goal itself had an error.NoActionDefinitionException - if a goal contains no action definition.public void attainGoal(java.lang.String name)
throws NoSuchGoalException,
UnattainableGoalException,
NoActionDefinitionException
name - The name of the goal to attain.NoSuchGoalException - if the name refers to no known goal.UnattainableGoalException - if a precursor or the goal itself had an error.NoActionDefinitionException - if a goal contains no action definition.public void percolateGoal(java.lang.String name)
throws NoSuchGoalException,
UnattainableGoalException,
NoActionDefinitionException
name - The name of the goal to percolate.NoSuchGoalException - if the name refers to no known goal.UnattainableGoalException - if a postcursor or the goal itself had an error.NoActionDefinitionException - if a goal contains no action definition.public void addGoal(Goal goal)
Goal to this manager.goal - The Goal to add.public Goal getGoal(java.lang.String name)
Goal by name from this manager.name - The name of the goal to retrieve.Goal associated with the name,
or null if there is no such Goal.public Goal getGoal(java.lang.String name, boolean create)
Goal by name from this manager.name - The name of the goal to retrieve.create - Flag indicating if a new Goal should
be created and returned if none currently exists
bound to name.Goal associated with the name,
or a new Goal if none was previously associated with
name.public void setDefaultGoalName(java.lang.String defaultGoalName)
defaultGoalName - The name of the default goal.public java.lang.String getDefaultGoalName()
null if not set.public Goal getDefaultGoal()
Goal or
null if a valid default
goal name has not been previously
specified using setDefaultGoalName(java.lang.String).public java.util.Collection getGoals()
Goals
that are a part of this Project.Goals
that are members of this Project.public java.lang.String toString()
toString in class java.lang.Objectpublic void removeGoal(java.lang.String name)
Copyright © 2001-2013 Apache Software Foundation. All Rights Reserved.