jist.runtime
Class Scheduler

java.lang.Object
  extended by jist.runtime.Scheduler
Direct Known Subclasses:
Scheduler.Calendar, Scheduler.Heap

abstract class Scheduler
extends java.lang.Object

Event scheduler interface and implementations.

Since:
JIST1.0
Version:
$Id: Scheduler.java,v 1.14 2005/03/13 16:11:54 barr Exp $
Author:
Rimon Barr <barr+jist@cs.cornell.edu>

Nested Class Summary
(package private) static class Scheduler.Calendar
          Implementation of calendar queue event scheduler.
(package private) static class Scheduler.Heap
          Implements an array-based heap of Events.
 
Constructor Summary
Scheduler()
           
 
Method Summary
 void clear()
          Clear all events in the queue.
abstract  void insert(Event ev)
          Insert event into event queue.
abstract  boolean isEmpty()
          Return whether event queue is empty.
static void main(java.lang.String[] args)
          Test various schedular implementations.
abstract  Event peekFirst()
          Peek at first event in queue.
abstract  Event removeFirst()
          Remove first event in queue.
abstract  int size()
          Return size of event queue.
private static void test(Scheduler s)
          Simple scheduler test...
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scheduler

Scheduler()
Method Detail

size

public abstract int size()
Return size of event queue.

Returns:
number of events in event queue

isEmpty

public abstract boolean isEmpty()
Return whether event queue is empty.

Returns:
whether event queue is empty

insert

public abstract void insert(Event ev)
Insert event into event queue.

Parameters:
ev - event to insert

removeFirst

public abstract Event removeFirst()
Remove first event in queue.

Returns:
first event (removed) from queue

peekFirst

public abstract Event peekFirst()
Peek at first event in queue.

Returns:
first event (still) in queue

clear

public void clear()
Clear all events in the queue.


test

private static void test(Scheduler s)
Simple scheduler test... Schedule random time events and then dequeue and check that they are coming in order.

Parameters:
s - scheduler to test

main

public static void main(java.lang.String[] args)
Test various schedular implementations.

Parameters:
args - command-line arguments