| java.lang.Object org.cougaar.planning.plugin.util.PluginHelper
All known Subclasses: org.cougaar.glm.plugins.TaskUtils, org.cougaar.logistics.plugin.inventory.TaskUtils,
PluginHelper | public class PluginHelper (Code) | | Container for various static helper methods used by Plugins
to manipulate Plan objects.
|
Method Summary | |
public static boolean | checkChangeReports(Set reports, Class cls) | public static AllocationResult | createEstimatedAllocationResult(Task t, PlanningFactory ldmf, double confrating, boolean success) Returns an AllocationResult based on the preferences of Task
and specified confidence rating and success .
Results are estimated to be the "best" possible based on the
preference scoring function. | public static double | getARAspectValue(AllocationResult ar, int type) | public static long | getEndTime(Task task) | public static double | getEndTime(AllocationResult ar) | public static AspectValue | getPreferenceBest(Task task, int aspect_type) | public static double | getPreferenceBestValue(Task task, int aspect_type) | public static long | getStartTime(Task task) | public static double | getStartTime(AllocationResult ar) | public static NewTask | makeSubtask(Task task, PlanningFactory ldmf) Returns a NewTask based on . | public static void | publishAddExpansion(BlackboardService sub, Expansion exp) | public static void | removeSubTask(BlackboardService sub, Task task) Helper to remove a task from an Expansion.
Removes the task from its workflow if not already done.
When doing so, also recalculate the received result on the Expansion, and publishChange
the Expansion if the result is now different. | public static void | updateAllocationResult(IncrementalSubscription sub) For each PlanElement of which has changed, if the
estimated and reported results are different, change
estimated to reported and publish the PlanElement change. | public static boolean | updatePlanElement(PlanElement pe) updatePlanElement looks for differences between the reported and
estimated allocation results. | public static Aggregation | wireAggregation(Task parent, NewMPTask mpTask, PlanningFactory ldmf, AllocationResult ar) Connect a parent task to an MPTask. | public static Collection | wireAggregation(Collection parents, NewMPTask mpTask, PlanningFactory ldmf, double confrating, boolean success) Connect a Collection of parent tasks to an MPTask. | public static Expansion | wireExpansion(Task parent, NewTask subTask, PlanningFactory ldmf) Returns an expansion based on and ,
with appropriate relations set. | public static Expansion | wireExpansion(Task parent, NewTask subTask, PlanningFactory ldmf, AllocationResult ar) Same as wireExpansion(Task, NewTask, PlanningFactory) but uses the
specified AllocationResult for the expansion. | public static void | wireExpansion(Expansion exp, NewTask subTask) | public static Expansion | wireExpansion(Task parentTask, Vector subTasks, PlanningFactory ldmf) Same as wireExpansion(Task, NewTask, PlanningFactory) except that a Vector
of subtasks is used. | public static Expansion | wireExpansion(Task parentTask, Vector subTasks, PlanningFactory ldmf, AllocationResult ar) |
checkChangeReports | public static boolean checkChangeReports(Set reports, Class cls)(Code) | | Check if a List of ChangeReports has an instance of a given class
|
createEstimatedAllocationResult | public static AllocationResult createEstimatedAllocationResult(Task t, PlanningFactory ldmf, double confrating, boolean success)(Code) | | Returns an AllocationResult based on the preferences of Task
and specified confidence rating and success .
Results are estimated to be the "best" possible based on the
preference scoring function. AllocationResult is null if
has no preferences.
|
getEndTime | public static long getEndTime(Task task)(Code) | | |
getPreferenceBestValue | public static double getPreferenceBestValue(Task task, int aspect_type)(Code) | | |
getStartTime | public static long getStartTime(Task task)(Code) | | |
makeSubtask | public static NewTask makeSubtask(Task task, PlanningFactory ldmf)(Code) | | Returns a NewTask based on . The NewTask
has identical Verb, DirectObject, Plan, Preferences,
Context, and PrepositionalPhrases as .
|
removeSubTask | public static void removeSubTask(BlackboardService sub, Task task)(Code) | | Helper to remove a task from an Expansion.
Removes the task from its workflow if not already done.
When doing so, also recalculate the received result on the Expansion, and publishChange
the Expansion if the result is now different. This permits the Expander Plugin to
copy the new result up the chain.
Note that normally the ReceivedResult would be updated by the LPs when one of the other sub-tasks
got a new AllocationResult. But that may not happen soon enough, or may never happen.
Note that the Plugin is responsible for publishRemoving the Task or re-parenting, as desired.
Parameters: sub - BlackboardService through which to do publishChange Parameters: task - sub-task being removed |
updateAllocationResult | public static void updateAllocationResult(IncrementalSubscription sub)(Code) | | For each PlanElement of which has changed, if the
estimated and reported results are different, change
estimated to reported and publish the PlanElement change.
|
updatePlanElement | public static boolean updatePlanElement(PlanElement pe)(Code) | | updatePlanElement looks for differences between the reported and
estimated allocation results. If they are not equal (== for now)
then the estimated value is set to the reported
value. Return true if has been changed, false otherwise.
|
wireAggregation | public static Aggregation wireAggregation(Task parent, NewMPTask mpTask, PlanningFactory ldmf, AllocationResult ar)(Code) | | Connect a parent task to an MPTask. If the MPTask does not have
a Composition one is created for it. The MPTask may already
have other Aggregations.
the Aggregation created. The caller is responsible for publishingthe new Aggregation. |
wireAggregation | public static Collection wireAggregation(Collection parents, NewMPTask mpTask, PlanningFactory ldmf, double confrating, boolean success)(Code) | | Connect a Collection of parent tasks to an MPTask. If the
MPTask does not have a Composition one is created for it. The
MPTask may already have other Aggregations. An estimated
AllocationResult is created for all Aggregations having a
confidence rating and success flag as specified by the
arguments.
Parameters: parents - the parents to be wired to the MPTask Parameters: mpTask - the MPTask of the aggregation Parameters: ldmf - the factory Parameters: confrating - the confidence rating of all the created Aggregations Parameters: success - the "success" flag for all the created Aggregations a Collection of the Aggregations created. These have _not_ beenpublished. The caller is responsible for publishing them. |
wireExpansion | public static Expansion wireExpansion(Task parent, NewTask subTask, PlanningFactory ldmf)(Code) | | Returns an expansion based on and ,
with appropriate relations set. Specifically,
puts the subtask in a NewWorkflow, sets the Workflow's
parent task to and sets the subtask Workflow.
Sets the subtask to be removed if the Workflow is removed.
If has no context, sets it to that of
Uses a null estimated AllocationResult for the expansion.
|
wireExpansion | public static void wireExpansion(Expansion exp, NewTask subTask)(Code) | | Wire a new subtask into an existing expansion
|
wireExpansion | public static Expansion wireExpansion(Task parentTask, Vector subTasks, PlanningFactory ldmf)(Code) | | Same as wireExpansion(Task, NewTask, PlanningFactory) except that a Vector
of subtasks is used. All the subtasks in the Vector are added to the
Workflow.
|
|
|