Jadex 0.96-beta1

jadex.runtime
Class MobilePlan

java.lang.Object
  extended by jadex.runtime.AbstractPlan
      extended by jadex.runtime.MobilePlan
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
RPInitiatorMobilePlan, TestsFinishedPlan

public abstract class MobilePlan
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
MobilePlan()
           
 
Method Summary
 void aborted()
          Deprecated. Replaced by aborted(event).
 void aborted(IEvent event)
          The plan was aborted (because of conditional goal success or termination from outside).
abstract  void action(IEvent event)
          The action methods is called on the instatiated plan instance from the scheduler.
 IFilter dispatchSubgoalAndWait(IGoal subgoal)
          A shortcut for dispatching a subgoal, and waiting for the subgoal to be finished (without timout).
 IFilter dispatchSubgoalAndWait(IGoal subgoal, long timeout)
          A shortcut for dispatching a subgoal, and waiting for the subgoal to be finished (with timout).
 void exception(Exception exception)
          The exception method is called when an exception occurred during plan processing.
 void failed()
          Deprecated. Replaced by failed(event).
 void failed(IEvent event)
          The failed method is called on plan failure/abort.
 void passed()
          Deprecated. Replaced by passed(event).
 void passed(IEvent event)
          The passed method is called on plan success.
 IFilter sendMessageAndWait(IMessageEvent me)
          Send a message and wait for the answer.
 IFilter sendMessageAndWait(IMessageEvent me, long timeout)
          Send a message and wait for the answer.
 IFilter waitFor(IFilter filter)
          Deprecated.  
 IFilter waitFor(IFilter filter, long timeout)
          Deprecated.  
 IFilter waitFor(long duration)
          Wait for a some time.
 IFilter waitForBeliefChange(String type)
          Wait for a belief change.
 IFilter waitForBeliefChange(String type, long timeout)
          Wait for a belief change.
 IFilter waitForBeliefSetChange(String type)
          Wait for a belief set change.
 IFilter waitForBeliefSetChange(String type, long timeout)
          Wait for a belief set change.
 IFilter waitForCondition(ICondition condition)
          Wait for a condition to be satisfied.
 IFilter waitForCondition(ICondition condition, long timeout)
          Wait for a condition or until the timeout occurs.
 IFilter waitForCondition(String condition)
          Wait for a condition to be satisfied.
 IFilter waitForCondition(String condition, long timeout)
          Wait for a condition to be satisfied.
 IFilter waitForFactAdded(String type)
          Wait for a belief set change.
 IFilter waitForFactAdded(String type, long timeout)
          Wait for a belief set change.
 IFilter waitForFactAddedOrRemoved(String type)
          Wait for a belief set change.
 IFilter waitForFactAddedOrRemoved(String type, long timeout)
          Wait for a belief set change.
 IFilter waitForFactRemoved(String type)
          Wait for a belief set change.
 IFilter waitForFactRemoved(String type, long timeout)
          Wait for a belief set change.
 IFilter waitForGoal(String type)
          Wait for a goal.
 IFilter waitForGoal(String type, long timeout)
          Wait for a goal.
 IFilter waitForInternalEvent(String type)
          Wait for an internal event.
 IFilter waitForInternalEvent(String type, long timeout)
          Wait for an internal event.
 IFilter waitForMessageEvent(String type)
          Wait for a message event.
 IFilter waitForMessageEvent(String type, long timeout)
          Wait for a message event.
 IFilter waitForReply(IMessageEvent msgevent)
          Wait for a message.
 IFilter waitForReply(IMessageEvent msgevent, long timeout)
          Wait for a message.
 IFilter waitForSubgoal(IGoal goal)
          Wait for a goal.
 IFilter 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

MobilePlan

public MobilePlan()
Method Detail

action

public abstract void action(IEvent event)
The action methods is called on the instatiated plan instance from the scheduler.


exception

public void exception(Exception exception)
               throws Exception
The exception method is called when an exception occurred during plan processing. The default behaviour is that the exception will be thrown and the plan fails. Method can be overridden for handling the exception.

Throws:
Exception

passed

public final void passed()
Deprecated. Replaced by passed(event).


failed

public final void failed()
Deprecated. Replaced by failed(event).


aborted

public final void aborted()
Deprecated. Replaced by aborted(event).


passed

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

Parameters:
event - The event (for subsequent calls, initially null).

failed

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

Parameters:
event - The event (for subsequent calls, initially null).

aborted

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

Parameters:
event - The event (for subsequent calls, initially null).

waitFor

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

Parameters:
duration - The duration.

waitForCondition

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

Parameters:
condition - The condition.

waitForCondition

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

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

waitForCondition

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

Parameters:
condition - The condition.

waitForCondition

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

Parameters:
condition - The condition.

dispatchSubgoalAndWait

public IFilter dispatchSubgoalAndWait(IGoal subgoal)
A shortcut for dispatching a subgoal, and waiting for the subgoal to be finished (without timout).

Parameters:
subgoal - The new subgoal.
Returns:
The eventfilter for identifying the result event.

dispatchSubgoalAndWait

public IFilter dispatchSubgoalAndWait(IGoal subgoal,
                                      long timeout)
A shortcut for dispatching a subgoal, and waiting for the subgoal to be finished (with timout).

Parameters:
subgoal - The new subgoal.
timeout - The timeout.
Returns:
The eventfilter for identifying the result event.

waitForInternalEvent

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

Parameters:
type - The internal event type.

waitForInternalEvent

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

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

sendMessageAndWait

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

Parameters:
me - The message event.
Returns:
The eventfilter for identifying the result event.

sendMessageAndWait

public IFilter 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 eventfilter for identifying the result event.

waitForMessageEvent

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

Parameters:
type - The message event type.

waitForMessageEvent

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

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

waitForReply

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

Parameters:
msgevent - The message event.

waitForReply

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

Parameters:
msgevent - The message event.

waitForGoal

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

Parameters:
type - The goal type.

waitForGoal

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

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

waitForSubgoal

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

Parameters:
goal - The goal.

waitForSubgoal

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

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

waitForBeliefChange

public IFilter 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 IFilter waitForBeliefChange(String type,
                                   long timeout)
Wait for a belief change.

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

waitForBeliefSetChange

public IFilter 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 IFilter 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 IFilter 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 IFilter 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 IFilter waitForFactAdded(String type)
Wait for a belief set change.

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

waitForFactAdded

public IFilter 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 IFilter waitForFactRemoved(String type)
Wait for a belief set change.

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

waitForFactRemoved

public IFilter 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 IFilter waitFor(IFilter filter)
Deprecated. 

Wait for an event.

Parameters:
filter - The event filter.

waitFor

public IFilter 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.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.