mx4j.util
Class TimeQueue

java.lang.Object
  |
  +--mx4j.util.TimeQueue

public class TimeQueue
extends java.lang.Object

A queue that executes TimeTasks.

Every scheduled task is executed at the specified time; if this time is in the past, the task is executed immediately. Just before the task is executed, the task itself is updated so that its new execution time is set or it is marked as finished (if it is not forever periodic).

Version:
$Revision: 1.4 $
Author:
Simone Bordet
See Also:
TimeTask

Constructor Summary
TimeQueue()
          Creates a new TimeQueue
 
Method Summary
 void clear()
          Removes all the tasks from this TimeQueue.
 void schedule(TimeTask task)
          Schedules the given task for execution.
 int size()
          Returns the number of tasks present in this TimeQueue
 void start()
          Starts this TimeQueue.
 void stop()
          Stops this TimeQueue.
 void unschedule(TimeTask task)
          Removes the given task from this TimeQueue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeQueue

public TimeQueue()
Creates a new TimeQueue
Method Detail

start

public void start()
Starts this TimeQueue.
Tasks is executed only after the queue is started.
See Also:
stop()

stop

public void stop()
Stops this TimeQueue.
No task is executed when the queue is stopped; however, already scheduled tasks are not removed; restarting the queue has the effect of executing the tasks remained if their time has come.
See Also:
start()

size

public int size()
Returns the number of tasks present in this TimeQueue

schedule

public void schedule(TimeTask task)
Schedules the given task for execution.
See Also:
unschedule(mx4j.util.TimeTask)

unschedule

public void unschedule(TimeTask task)
Removes the given task from this TimeQueue
See Also:
schedule(mx4j.util.TimeTask)

clear

public void clear()
Removes all the tasks from this TimeQueue.


Copyright © 2001-2002 MX4J Team. All Rights Reserved.