|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--haifa.shopsim.fastkernel.EventQ
This class keeps a record of the next events in the machine world that are to occur. It is designed specfically for the job shop setting. An event is simply defined by a machine. The methods getNextTime() and getNextMachines are to be used with care. The getNextTime method should be called before the getNextMachines method. This is because the getNextTime method does not alter the Q while the getNextMachines methods removes the next machines from the Q.
Inner Class Summary | |
(package private) class |
EventQ.Event
A node in the event Q. pnext points to null if this is the head of the queue. pprev points to null if this is the tail of the queue. |
Field Summary | |
(package private) int |
numInQ
Stores how many events are currently in the queue. |
protected EventQ.Event |
phead
Points to the head event of the queue |
protected EventQ.Event |
ptail
Points to the tail event (highest time) of the queue. |
Constructor Summary | |
EventQ()
Creates new empty EventQ. |
Method Summary | |
(package private) double |
getMachineTime(int number)
Returns the earliest time that the machine is scheduled on or -1.0 if it is not scheduled. |
(package private) int[] |
getNextMachines()
Returns an array of the machine numbers of the next machines in the Q (machines with earliest time).A meachine may appear several times in this array. |
(package private) double |
getNextTime()
Returns the time of the next event in the Q. |
static void |
main(java.lang.String[] args)
For testing. |
void |
removeMachine(int number)
Removes a machine from the EventQ. |
void |
removeMachine(int number,
double untilTime)
Removes all events of a machine from the EventQ which are before untilTime. |
(package private) void |
scheduleMachine(int machine,
double endTime)
Schedules an event for a machine to wake up at endTime. |
private void |
testAdd(int machine,
double time)
|
private void |
testRemove(int machine)
|
private void |
testRemoveNext()
For testing. |
java.lang.String |
toString()
Generates string of all events starting at the head. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected EventQ.Event phead
protected EventQ.Event ptail
int numInQ
Constructor Detail |
public EventQ()
Method Detail |
int[] getNextMachines()
double getNextTime()
double getMachineTime(int number)
void scheduleMachine(int machine, double endTime)
public void removeMachine(int number)
public void removeMachine(int number, double untilTime)
public java.lang.String toString()
toString
in class java.lang.Object
private void testAdd(int machine, double time)
private void testRemove(int machine)
private void testRemoveNext()
public static void main(java.lang.String[] args)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |