com.caucho.util
Class AbstractSoftScheduler<E extends TimeIntervalEntry>

java.lang.Object
  extended by com.caucho.util.AbstractSoftScheduler<E>
All Implemented Interfaces:
TimeIntervalScheduler<E>

public class AbstractSoftScheduler<E extends TimeIntervalEntry>
extends java.lang.Object
implements TimeIntervalScheduler<E>

Provides an implementation of the for managing schedules based on soft or weak references to the entries in the schedule.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.caucho.util.TimeIntervalScheduler
TimeIntervalScheduler.ScheduleType
 
Constructor Summary
AbstractSoftScheduler(long clockTic)
          Creates a mamp of TimeIntervals of the requested size.
AbstractSoftScheduler(long clockTic, TimeIntervalScheduler.ScheduleType scheduleType)
          Creates a mamp of TimeIntervals of the requested size.
 
Method Summary
 TimeInterval getSchedulerInterval(long time)
          Returns the schedule interval for the designated time.
 TimeInterval getSchedulerInterval(long time, long interavalDuration)
          Returns the TimeInterval containing the moment, based on a schedule of
 void schedule(E entry)
          Schedules the entry to the current interval of the map.
 void schedule(E entry, long time)
          Schedules an entry to the map's interval for time time
 void schedule(E entry, TimeInterval timeInterval)
          The event will be scheduled to ocuur anytime within the designated time interval.
 int scheduleSize(long time)
          Returns the size of the queue for the specified time.
 int size()
          Returns the number of distinct time intervals held by the schedule.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractSoftScheduler

public AbstractSoftScheduler(long clockTic)
Creates a mamp of TimeIntervals of the requested size.

Parameters:
clockTic -

AbstractSoftScheduler

public AbstractSoftScheduler(long clockTic,
                             TimeIntervalScheduler.ScheduleType scheduleType)
Creates a mamp of TimeIntervals of the requested size.

Parameters:
clockTic -
Method Detail

schedule

public final void schedule(E entry)
Schedules the entry to the current interval of the map.

Specified by:
schedule in interface TimeIntervalScheduler<E extends TimeIntervalEntry>

schedule

public final void schedule(E entry,
                           long time)
Schedules an entry to the map's interval for time time

Specified by:
schedule in interface TimeIntervalScheduler<E extends TimeIntervalEntry>
Parameters:
entry -
time -

schedule

public final void schedule(E entry,
                           TimeInterval timeInterval)
The event will be scheduled to ocuur anytime within the designated time interval.

Specified by:
schedule in interface TimeIntervalScheduler<E extends TimeIntervalEntry>
Parameters:
entry - to add to the schedule
timeInterval - during which the entry may be scheduled

getSchedulerInterval

public final TimeInterval getSchedulerInterval(long time)
Returns the schedule interval for the designated time.

Specified by:
getSchedulerInterval in interface TimeIntervalScheduler<E extends TimeIntervalEntry>
Parameters:
time - within the interval
Returns:
an interval that contains the moment.

getSchedulerInterval

public final TimeInterval getSchedulerInterval(long time,
                                               long interavalDuration)
Returns the TimeInterval containing the moment, based on a schedule of

Specified by:
getSchedulerInterval in interface TimeIntervalScheduler<E extends TimeIntervalEntry>
Parameters:
time -
interavalDuration -
Returns:

size

public int size()
Returns the number of distinct time intervals held by the schedule.

Returns:

scheduleSize

public int scheduleSize(long time)
Returns the size of the queue for the specified time.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object