Jadex 0.96-beta1

jadex.runtime
Class Plan

java.lang.Object
  extended by jadex.runtime.AbstractPlan
      extended by jadex.runtime.Plan
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AnswerPingPlan, CNPInitiatorPlan, CNPReceiverPlan, DAInitiatorPlan, DAReceiverPlan, DoPingPlan, EAInitiatorPlan, EAReceiverPlan, NotUnderstoodPlan, PerformTestPlan, PerformTestsPlan, PingingPlan, PrintReportsPlan, RPInitiatorPlan, RPReceiverPlan, SendReportsPlan, StartAgentsPlan, TestCenterPlan

public abstract class Plan
extends AbstractPlan

A plan (in our context more a plan body) contains actions for accomplishing a target state. Additionally to plan belongs (stored in plan info): - filters (waitqueuefilter, planfilter) Subclasses of plan have to implement the action method.

See Also:
Serialized Form

Constructor Summary
Plan()
          Create a new plan.
 
Method Summary
 void aborted()
          The plan was aborted (because of conditional goal success or termination from outside).
abstract  void body()
          The body method is called on the instatiated plan instance from the scheduler.
 void dispatchSubgoalAndWait(IGoal subgoal)
          A shortcut for dispatching a goal as subgoal of the active goal,, and waiting for the subgoal to be finished (without timout).
 void dispatchSubgoalAndWait(IGoal subgoal, long timeout)
          A shortcut for dispatching a goal as subgoal of the active goal and waiting for the subgoal to be finished.
 void failed()
          The failed method is called on plan failure/abort.
 IEvent getInitialEvent()
          Get the initial event, which might differ from the plans rootgoal.
 void passed()
          The passed method is called on plan success.
 IMessageEvent sendMessageAndWait(IMessageEvent me)
          Send a message and wait for the answer.
 IMessageEvent sendMessageAndWait(IMessageEvent me, long timeout)
          Send a message and wait for the answer.
 IEvent waitFor(IFilter filter)
          Wait for an event.
 IEvent waitFor(IFilter filter, long timeout)
          Wait for an event or until the timeout occurs.
 void waitFor(long duration)
          Wait for a some time.
 Object waitForBeliefChange(String type)
          Wait for a belief change.
 Object waitForBeliefChange(String type, long timeout)
          Wait for a belief change.
 void waitForBeliefSetChange(String type)
          Wait for a belief set change.
 void waitForBeliefSetChange(String type, long timeout)
          Wait for a belief set change.
 void waitForCondition(ICondition condition)
          Wait for a condition to be satisfied.
 void waitForCondition(ICondition condition, long timeout)
          Wait for a condition or until the timeout occurs.
 void waitForCondition(String condition)
          Wait for a condition to be satisfied.
 void waitForCondition(String condition, long timeout)
          Wait for a condition to be satisfied.
 Object waitForFactAdded(String type)
          Wait for a belief set change.
 Object waitForFactAdded(String type, long timeout)
          Wait for a belief set change.
 Object waitForFactAddedOrRemoved(String type)
          Wait for a belief set change.
 Object waitForFactAddedOrRemoved(String type, long timeout)
          Wait for a belief set change.
 Object waitForFactRemoved(String type)
          Wait for a belief set change.
 Object waitForFactRemoved(String type, long timeout)
          Wait for a belief set change.
 IGoal waitForGoal(String type)
          Wait for a goal.
 IGoal waitForGoal(String type, long timeout)
          Wait for a goal.
 IInternalEvent waitForInternalEvent(String type)
          Wait for an internal event.
 IInternalEvent waitForInternalEvent(String type, long timeout)
          Wait for an internal event.
 IMessageEvent waitForMessageEvent(String type)
          Wait for a message event.
 IMessageEvent waitForMessageEvent(String type, long timeout)
          Wait for a message event.
 IMessageEvent waitForReply(IMessageEvent msgevent)
          Wait for a message.
 IMessageEvent waitForReply(IMessageEvent msgevent, long timeout)
          Wait for a message.
 void waitForSubgoal(IGoal goal)
          Wait for a goal.
 void waitForSubgoal(IGoal goal, long timeout)
          Wait for a goal.
 
Methods inherited from class jadex.runtime.AbstractPlan
addPlanListener, createCondition, createCondition, createExpression, createExpression, createGoal, createInternalEvent, createInternalEvent, createMessageEvent, createQuery, dispatchInternalEvent, dispatchSubgoal, dispatchTopLevelGoal, endAtomic, fail, fail, fail, getAgentIdentifier, getAgentName, getBeliefbase, getCondition, getEventbase, getException, getExpression, getExpressionbase, getExternalAccess, getGoalbase, getLogger, getName, getParameter, getParameters, getParameterSet, getParameterSets, getPlanbase, getPropertybase, getQuery, getRootGoal, getRPlan, getScope, getWaitqueue, hasParameter, hasParameterSet, isAbortedOnSuccess, killAgent, removePlanListener, sendMessage, startAtomic, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Plan

public Plan()
Create a new plan.

Method Detail

body

public abstract void body()
The body method is called on the instatiated plan instance from the scheduler.


passed

public void passed()
The passed method is called on plan success.


failed

public void failed()
The failed method is called on plan failure/abort.


aborted

public void aborted()
The plan was aborted (because of conditional goal success or termination from outside).


getInitialEvent

public IEvent getInitialEvent()
Get the initial event, which might differ from the plans rootgoal.


waitFor

public void waitFor(long duration)
Wait for a some time.

Parameters:
duration - The duration.

waitForCondition

public void waitForCondition(ICondition condition)
Wait for a condition to be satisfied.

Parameters:
condition - The condition.

waitForCondition

public void waitForCondition(ICondition condition,
                             long timeout)
Wait for a condition or until the timeout occurs.

Parameters:
condition - The condition.
timeout - The timeout.

waitForCondition

public void waitForCondition(String condition)
Wait for a condition to be satisfied.

Parameters:
condition - The condition.

waitForCondition

public void waitForCondition(String condition,
                             long timeout)
Wait for a condition to be satisfied.

Parameters:
condition - The condition.

dispatchSubgoalAndWait

public void dispatchSubgoalAndWait(IGoal subgoal)
                            throws GoalFailureException
A shortcut for dispatching a goal as subgoal of the active goal,, and waiting for the subgoal to be finished (without timout).

Parameters:
subgoal - The new subgoal.
Throws:
GoalFailureException - when the goal fails.

dispatchSubgoalAndWait

public void dispatchSubgoalAndWait(IGoal subgoal,
                                   long timeout)
A shortcut for dispatching a goal as subgoal of the active goal and waiting for the subgoal to be finished. Additionally the subgoal will be dropped when finished. This differs from the dispatchSubgoal implementation.

Parameters:
subgoal - The new subgoal.
timeout - The timeout.

waitForInternalEvent

public IInternalEvent waitForInternalEvent(String type)
Wait for an internal event.

Parameters:
type - The internal event type.

waitForInternalEvent

public IInternalEvent waitForInternalEvent(String type,
                                           long timeout)
Wait for an internal event.

Parameters:
type - The internal event type.
timeout - The timeout.

sendMessageAndWait

public IMessageEvent sendMessageAndWait(IMessageEvent me)
Send a message and wait for the answer.

Parameters:
me - The message event.
Returns:
The result event.

sendMessageAndWait

public IMessageEvent sendMessageAndWait(IMessageEvent me,
                                        long timeout)
Send a message and wait for the answer. Adds a reply-with entry if not present, for tracking the conversation.

Parameters:
me - The message event.
timeout - The timeout.
Returns:
The result event.

waitForMessageEvent

public IMessageEvent waitForMessageEvent(String type)
Wait for a message event.

Parameters:
type - The message event type.

waitForMessageEvent

public IMessageEvent waitForMessageEvent(String type,
                                         long timeout)
Wait for a message event.

Parameters:
type - The message event type.
timeout - The timeout.

waitForReply

public IMessageEvent waitForReply(IMessageEvent msgevent)
Wait for a message.

Parameters:
msgevent - The message event.

waitForReply

public IMessageEvent waitForReply(IMessageEvent msgevent,
                                  long timeout)
Wait for a message.

Parameters:
msgevent - The message event.

waitForGoal

public IGoal waitForGoal(String type)
Wait for a goal.

Parameters:
type - The goal type.

waitForGoal

public IGoal waitForGoal(String type,
                         long timeout)
Wait for a goal.

Parameters:
type - The goal type.
timeout - The timeout.

waitForSubgoal

public void waitForSubgoal(IGoal goal)
Wait for a goal.

Parameters:
goal - The goal.

waitForSubgoal

public void waitForSubgoal(IGoal goal,
                           long timeout)
Wait for a goal.

Parameters:
goal - The goal.
timeout - The timeout.

waitForBeliefChange

public Object waitForBeliefChange(String type)
Wait for a belief change.

Parameters:
type - The internal event type.
Returns:
The changed fact value.

waitForBeliefChange

public Object waitForBeliefChange(String type,
                                  long timeout)
Wait for a belief change.

Parameters:
type - The belief type.
timeout - The timeout.

waitForBeliefSetChange

public void waitForBeliefSetChange(String type)
Wait for a belief set change.

Parameters:
type - The belief set type.

waitForBeliefSetChange

public void waitForBeliefSetChange(String type,
                                   long timeout)
Wait for a belief set change.

Parameters:
type - The belief set type.
timeout - The timeout.

waitForFactAddedOrRemoved

public Object waitForFactAddedOrRemoved(String type)
Wait for a belief set change.

Parameters:
type - The belief set type.
Returns:
The fact that was added or removed.

waitForFactAddedOrRemoved

public Object waitForFactAddedOrRemoved(String type,
                                        long timeout)
Wait for a belief set change.

Parameters:
type - The belief set type.
timeout - The timeout.
Returns:
The fact that was added or removed.

waitForFactAdded

public Object waitForFactAdded(String type)
Wait for a belief set change.

Parameters:
type - The belief set type.
Returns:
The fact that was added.

waitForFactAdded

public Object waitForFactAdded(String type,
                               long timeout)
Wait for a belief set change.

Parameters:
type - The belief set type.
timeout - The timeout.
Returns:
The fact that was added.

waitForFactRemoved

public Object waitForFactRemoved(String type)
Wait for a belief set change.

Parameters:
type - The belief set type.
Returns:
The fact that was added.

waitForFactRemoved

public Object waitForFactRemoved(String type,
                                 long timeout)
Wait for a belief set change.

Parameters:
type - The belief set type.
timeout - The timeout.
Returns:
The fact that was added.

waitFor

public IEvent waitFor(IFilter filter)
Wait for an event.

Parameters:
filter - The event filter. //@deprecated Should be avoided but in certain cases maybe cannot

waitFor

public IEvent waitFor(IFilter filter,
                      long timeout)
Wait for an event or until the timeout occurs.

Parameters:
filter - The event filter.
timeout - The timeout. //@deprecated Should be avoided but in certain cases maybe cannot

Jadex 0.96-beta1

Submit a bug or feature
For further API reference and developer documentation, see the Jadex User Guide and the Jadex Tutorial. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, and working code examples.

Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.