Jadex 0.941

jadex.runtime
Class Plan

java.lang.Object
  extended byjadex.runtime.AbstractPlan
      extended byjadex.runtime.Plan
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
FIPARequestInitiatorPlan, NotUnderstoodPlan, PingingPlan, PingPlan, StartAgentsPlan

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.
 IGoalEvent 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).
 IGoalEvent 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)
          Deprecated.  
 IEvent waitFor(IFilter filter, long timeout)
          Deprecated.  
 IEvent waitFor(long duration)
          Wait for a some time.
 IInternalEvent waitForBeliefChange(String type)
          Wait for a belief change.
 IInternalEvent waitForBeliefChange(String type, long timeout)
          Wait for a belief change.
 IInternalEvent waitForBeliefSetChange(String type)
          Wait for a belief set change.
 IInternalEvent waitForBeliefSetChange(String type, long timeout)
          Wait for a belief set change.
 IEvent waitForCondition(ICondition condition)
          Wait for a condition to be satisfied.
 IEvent waitForCondition(ICondition condition, long timeout)
          Wait for a condition or until the timeout occurs.
 IEvent waitForCondition(String condition)
          Wait for a condition to be satisfied.
 IEvent 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.
 IInternalEvent waitForFactAddedOrRemoved(String type)
          Wait for a belief set change.
 IInternalEvent 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.
 IGoalEvent waitForGoal(String type)
          Wait for a goal.
 IGoalEvent 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.
 IGoalEvent waitForSubgoal(IGoal goal)
          Wait for a goal.
 IGoalEvent waitForSubgoal(IGoal goal, long timeout)
          Wait for a goal.
 
Methods inherited from class jadex.runtime.AbstractPlan
createCondition, createCondition, createExpression, createExpression, createGoal, createInternalEvent, createInternalEvent, createMessageEvent, createMessageEventFromNative, createQuery, dispatchInternalEvent, dispatchSubgoal, dispatchTopLevelGoal, endAtomic, fail, 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, sendMessage, setException, 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 IEvent waitFor(long duration)
Wait for a some time.

Parameters:
duration - The duration.

waitForCondition

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

Parameters:
condition - The condition.

waitForCondition

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

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

waitForCondition

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

Parameters:
condition - The condition.

waitForCondition

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

Parameters:
condition - The condition.

dispatchSubgoalAndWait

public IGoalEvent 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.
Returns:
The result event.
Throws:
GoalFailureException - when the goal fails.

dispatchSubgoalAndWait

public IGoalEvent 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.
Returns:
The result event.

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 IGoalEvent waitForGoal(String type)
Wait for a goal.

Parameters:
type - The goal type.

waitForGoal

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

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

waitForSubgoal

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

Parameters:
goal - The goal.

waitForSubgoal

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

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

waitForBeliefChange

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

Parameters:
type - The internal event type. todo: returns a condition triggered event? or new BeliefChanged event?

waitForBeliefChange

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

Parameters:
type - The belief type.
timeout - The timeout. todo: returns a condition triggered event? or new BeliefChanged event?

waitForBeliefSetChange

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

Parameters:
type - The belief set type. todo: returns a condition triggered event? or new BeliefChanged event?

waitForBeliefSetChange

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

Parameters:
type - The belief set type.
timeout - The timeout. todo: returns a condition triggered event? or new BeliefChanged event?

waitForFactAddedOrRemoved

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

Parameters:
type - The belief set type. todo: returns a condition triggered event? or new BeliefChanged event?

waitForFactAddedOrRemoved

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

Parameters:
type - The belief set type.
timeout - The timeout. todo: returns a condition triggered event? or new BeliefChanged event?

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)
Deprecated.  

Wait for an event.

Parameters:
filter - The event filter.

waitFor

public IEvent waitFor(IFilter filter,
                      long timeout)
Deprecated.  

Wait for an event or until the timeout occurs.

Parameters:
filter - The event filter.
timeout - The timeout.

Jadex 0.941

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-2005 Lars Braubach, Alexander Pokahr, Andrzej Walczak - University of Hamburg. Use is subject to license terms.