com.ibm.agletx.util
Class SeqPlanItinerary

java.lang.Object
  |
  +--com.ibm.aglet.event.MobilityAdapter
        |
        +--com.ibm.agletx.util.SeqItinerary
              |
              +--com.ibm.agletx.util.SeqPlanItinerary
All Implemented Interfaces:
java.util.EventListener, MobilityListener, java.io.Serializable

public class SeqPlanItinerary
extends SeqItinerary

SeqPlanItinerary defines the trip plan which has a sequence of place-message pair. For example, the plan defined like:

 itinerary.addPlan("atp://first", "job1");
 itinerary.addPlan("atp://second", "job2");
 
first dispatches an aglet to the "atp://first" and sends new Message("job1") message to the aglet. After that message handling is completed, the itinerary dispatches the aglet to the next address, "atp://second" , and send the corresponding message new Message("job2", init) to the aglet again. The order of plan is defined in the order addPlan method is called, or you can insert a new plan item at the specified index by calling insertPlanAt . To automatically dispatches an aglet to the next address when the job is completed, the aglet have to have the following block

Version:
1.10 $Date: 2001/07/28 06:33:40 $
Author:
Mitsuru Oshima, Yariv Aridor
See Also:
Serialized Form

Fields inherited from class com.ibm.agletx.util.SeqItinerary
aglet, currentTarget
 
Constructor Summary
SeqPlanItinerary(Aglet aglet)
          Constructs a SeqPlanItinerary object with the specified owner aglet.
 
Method Summary
 void addPlan(java.lang.String address, Message msg)
          Adds the new itinerary item of the form [address, message].
 void addPlan(java.lang.String address, java.lang.String msg)
          Adds the new itinerary item of the form [address, message].
 Message getMessageAt(int index)
           
 void onArrival(MobilityEvent ev)
          This is not normally used by aglets programmers.
 void removePlanAt(int index)
           
 
Methods inherited from class com.ibm.agletx.util.SeqItinerary
addAddress, addresses, addTask, atLastDestination, clear, getAddressAt, getCurrentAddress, getCurrentTask, getOrigin, getOwnerAglet, getTaskAt, goToNext, handleException, handleTripException, indexOf, indexOf, isRepeat, onTermination, removeTaskAt, setRepeat, size, startTrip
 
Methods inherited from class com.ibm.aglet.event.MobilityAdapter
onDispatching, onReverting
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SeqPlanItinerary

public SeqPlanItinerary(Aglet aglet)
Constructs a SeqPlanItinerary object with the specified owner aglet.
Parameters:
aglet - the owner aglet
Method Detail

addPlan

public void addPlan(java.lang.String address,
                    Message msg)
Adds the new itinerary item of the form [address, message].
Parameters:
address - the address to go
msg - the message to be sent to the owner aglet

addPlan

public void addPlan(java.lang.String address,
                    java.lang.String msg)
Adds the new itinerary item of the form [address, message]. This is added at the end of plan.
Parameters:
address - the address to go
msg - the message to be sent to the owner aglet

getMessageAt

public Message getMessageAt(int index)

onArrival

public void onArrival(MobilityEvent ev)
Description copied from class: SeqItinerary
This is not normally used by aglets programmers.
Overrides:
onArrival in class SeqItinerary

removePlanAt

public void removePlanAt(int index)