policyMgmt
Class CalendarTimer

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--policyMgmt.CalendarTimer

public class CalendarTimer
extends java.lang.Thread
implements EventGenerator

This is an EventGenerator for TimeEvents that are sent on specific dates.


Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
CalendarTimer(Policy policy)
          Constructs a CalendarTimer.
CalendarTimer(Policy policy, java.util.Date when)
          Constructs a CalendarTimer and adds a given date to trigger.
 
Method Summary
 void addDate(java.util.Date when)
          Add a trigger Date.
 void clearDate(java.util.Date when)
          Remove a Date.
 void expire(java.util.Date now)
          Remove passed Date.
 java.util.Date getFirst()
          Retrieve the next upcoming scheduled Date
 java.util.Date getNext(java.util.Date when)
          Retrieve the next scheduled Date after a given reference Date.
 boolean isEmpty()
          Check whether the queue of scheduled upcoming Events is empty.
 void run()
          The main loop of the CalendarTimer Thread.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CalendarTimer

public CalendarTimer(Policy policy)
Constructs a CalendarTimer.
Parameters:
policy - the Policy to receive the Events of this CalendarTimer

CalendarTimer

public CalendarTimer(Policy policy,
                     java.util.Date when)
Constructs a CalendarTimer and adds a given date to trigger.
Parameters:
policy - the Policy to receive the Events of this CalendarTimer
when - the Date to trigger
Method Detail

addDate

public void addDate(java.util.Date when)
Add a trigger Date.
Parameters:
when - the new Date

clearDate

public void clearDate(java.util.Date when)
Remove a Date.
Parameters:
when - the new Date

expire

public void expire(java.util.Date now)
Remove passed Date.
Parameters:
now - the reference Date (usually the current Date)

isEmpty

public boolean isEmpty()
Check whether the queue of scheduled upcoming Events is empty.
Returns:
true, if queue is empty

getFirst

public java.util.Date getFirst()
Retrieve the next upcoming scheduled Date
Returns:
the Date

getNext

public java.util.Date getNext(java.util.Date when)
                       throws java.util.NoSuchElementException
Retrieve the next scheduled Date after a given reference Date.
Parameters:
when - the reference Date
Returns:
the next scheduled Date after the reference Date

run

public void run()
The main loop of the CalendarTimer Thread.
Overrides:
run in class java.lang.Thread