|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjist.runtime.Scheduler
jist.runtime.Scheduler.Calendar
static final class Scheduler.Calendar
Implementation of calendar queue event scheduler. See R.Brown. "Calendar queues: A fast O(1) priority queue implementation for the simulation event set problem." Comm. of ACM, 31(10):1220-1227, Oct 1988
Nested Class Summary |
---|
Nested classes/interfaces inherited from class jist.runtime.Scheduler |
---|
Scheduler.Calendar, Scheduler.Heap |
Field Summary | |
---|---|
private long |
binMax
Maximum time threshold of lastBin. |
private Scheduler.Heap[] |
bins
Calendar days. |
private long |
binWidth
Width of a single bin (length of a day). |
private int |
lastBin
Last "day" where event was found. |
private int |
size
Event queue size. |
Constructor Summary | |
---|---|
Scheduler.Calendar(long width,
int nbins)
Create a calendar scheduler with given number of bins and bin width. |
Method Summary | |
---|---|
private int |
getBin(long time)
Return mapped bin index for a given time. |
void |
insert(Event e)
Insert event into event queue. |
boolean |
isEmpty()
Return whether event queue is empty. |
private int |
minBin()
Return bin with minimum time event -- linear scan. |
private int |
nextBin()
Scan for and return next bin with an event with the next calendar year, or use minBin (above) to find bin with minimum event using direct search. |
Event |
peekFirst()
Peek at first event in queue. |
Event |
removeFirst()
Remove first event in queue. |
int |
size()
Return size of event queue. |
Methods inherited from class jist.runtime.Scheduler |
---|
clear, main |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Scheduler.Heap[] bins
private int size
private int lastBin
private long binWidth
private long binMax
Constructor Detail |
---|
public Scheduler.Calendar(long width, int nbins)
width
- total width of all bins (length of a year)nbins
- number of bins (number of days in a year)Method Detail |
---|
private int getBin(long time)
time
- event time
private int minBin()
private int nextBin()
public void insert(Event e)
insert
in class Scheduler
e
- event to insertpublic Event removeFirst()
removeFirst
in class Scheduler
public Event peekFirst()
peekFirst
in class Scheduler
public int size()
size
in class Scheduler
public boolean isEmpty()
isEmpty
in class Scheduler
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |