All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class RouterLayer.Router.Reservation

RouterLayer.Router.Reservation

public class Reservation
Reservation class to reserve message to the Router. The Reservation object will be created by RouterRecvThread and it will be added to the _reservedBook data member of RouterAction. While looping, the RouterAction will check that the Reservation time. If the time is less than the current time, the Router will send message to the reserved receiver.


Constructor Index

 o Reservation(String, Address, String)
Constructor
 o Reservation(String, Address, String, int)
Constructor

Method Index

 o getAddress()
Get reserved address
 o getReceiver()
Get intended receiver
 o getTime()
Get reservation time as long
 o getTimeString()
Get reservation time as string
 o getTrialTimes()
 o getTryTimes()
Get trial times
 o incTimes()
Increase trial times by one
 o overMaxTimes()
Return true of the trial times is greater than the maximum trial times
 o setTime(long)

Constructors

 o Reservation
 public Reservation(String receiver,
                    Address address,
                    String time,
                    int maxTimes)
Constructor

Parameters:
receiver - Intended receiver. May be different from the reserver
address - Intended receiving location. Can be passed as null if the location to receive is not different from the most recent connection location
time - Reservation time stamp
maxTimes - Maximum trial times
 o Reservation
 public Reservation(String receiver,
                    Address address,
                    String time)
Constructor

Parameters:
receiver - Intended receiver. May be different from the reserver
address - Intended receiving location. Can be passed as null if the location to receive is not different from the most recent connection location
time - Reservation time stamp

Methods

 o incTimes
 public void incTimes()
Increase trial times by one

 o getTryTimes
 public int getTryTimes()
Get trial times

Returns:
Current trial times
 o getAddress
 public Address getAddress()
Get reserved address

Returns:
Reserved location address
 o getReceiver
 public String getReceiver()
Get intended receiver

Returns:
Intended receiver
 o getTimeString
 public String getTimeString()
Get reservation time as string

Returns:
Time stamp
 o getTime
 public long getTime()
Get reservation time as long

 o setTime
 public void setTime(long time)
 o getTrialTimes
 public int getTrialTimes()
 o overMaxTimes
 public boolean overMaxTimes()
Return true of the trial times is greater than the maximum trial times

Returns:
true if the trial times is greater than the maximum trial times

All Packages  Class Hierarchy  This Package  Previous  Next  Index