agentland.util.scheduler
Class ReminderRecord

java.lang.Object
  |
  +--agentland.util.scheduler.ReminderRecord
All Implemented Interfaces:
Comparable, Serializable
Direct Known Subclasses:
IntervalReminder, OneTimeReminder

public abstract class ReminderRecord
extends Object
implements Serializable, Comparable

See Also:
Serialized Form

Field Summary
protected  AgentID aid
           
protected  long expiresAfter
           
protected  long id
           
protected  Serializable message
           
protected  String method
           
static long NEVER
           
protected  boolean wakeup
           
 
Constructor Summary
ReminderRecord(AgentID aid, String method, Serializable message)
           
ReminderRecord(AgentID aid, String method, Serializable message, boolean wakeup)
           
 
Method Summary
 int compareTo(Object o)
           
 boolean dead()
          Return true if the reminder is dead (either issued or worthless)
static long futureTime(int number, String unit)
           
 AgentID getAgentID()
           
 long getExpiresAfter()
           
 long getID()
           
 Serializable getMessage()
           
 String getMethodName()
           
 boolean getWakeup()
           
abstract  long nextActivation()
           
abstract  void reminderIssued(long time)
          After reminding an agent, you should notify the ReminderRecord about it (so that it knows reminder has been issued and is not past due)
 void setExpiresAfter(long exp)
          Set the (relative) time after which the reminder will no longer make sense; this is for overdue reminders (if the system is down when the reminder has to be issued and gets up after the reminder was due, when would it make sense to still issue the reminder and when it would not...
 void setID(long id)
           
static long timeFromNow(int number, String unit)
          Return a time duration in milliseconds.
static long timeInMillis(int number, String unit)
          Return a time duration in milliseconds.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NEVER

public static final long NEVER

method

protected String method

message

protected Serializable message

aid

protected AgentID aid

id

protected long id

wakeup

protected boolean wakeup

expiresAfter

protected long expiresAfter
Constructor Detail

ReminderRecord

public ReminderRecord(AgentID aid,
                      String method,
                      Serializable message)

ReminderRecord

public ReminderRecord(AgentID aid,
                      String method,
                      Serializable message,
                      boolean wakeup)
Method Detail

nextActivation

public abstract long nextActivation()

reminderIssued

public abstract void reminderIssued(long time)
After reminding an agent, you should notify the ReminderRecord about it (so that it knows reminder has been issued and is not past due)

compareTo

public int compareTo(Object o)
              throws ClassCastException
Specified by:
compareTo in interface Comparable

getMethodName

public String getMethodName()

getMessage

public Serializable getMessage()

getAgentID

public AgentID getAgentID()

getID

public long getID()

setID

public void setID(long id)

getWakeup

public boolean getWakeup()

setExpiresAfter

public void setExpiresAfter(long exp)
Set the (relative) time after which the reminder will no longer make sense; this is for overdue reminders (if the system is down when the reminder has to be issued and gets up after the reminder was due, when would it make sense to still issue the reminder and when it would not...

getExpiresAfter

public long getExpiresAfter()

dead

public boolean dead()
Return true if the reminder is dead (either issued or worthless)

futureTime

public static long futureTime(int number,
                              String unit)

timeFromNow

public static long timeFromNow(int number,
                               String unit)
Return a time duration in milliseconds.
Parameters:
unit - The units of number. You have "sec", "min", "hours", or "days"
Returns:
length of time in milliseconds.

timeInMillis

public static long timeInMillis(int number,
                                String unit)
Return a time duration in milliseconds.
Parameters:
unit - The units of number. You have "sec", "min", "hours", or "days"
Returns:
length of time in milliseconds.

toString

public String toString()
Overrides:
toString in class Object