|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--EventTimer
A class used to assign random times to all of the events which take place in the lunch-seating simulation. Because two seating schemes will be compared, it is important that both schemes have the same input: that each party which will arrive has the same arrival time between schemes, and that both eating times are equivalent. This may be accomplished by seeding the random number generators.
Party
,
Clock
,
Event
Field Summary | |
private java.util.Random |
arrivalTimer
A random number generator to generate arrival times |
private java.util.Random |
eatingTimer
A random number generator to generate eating times |
static int |
LUNCH_TIME
The number of minutes that lunch is served on the cruise ship |
static int |
MAX_EATING_TIME
The maximum amount of time a party can take to eat their lunch |
static int |
MIN_EATING_TIME
The minimum amount of time a party can take to eat their lunch |
Constructor Summary | |
EventTimer()
Creates a new, non-seeded EventTimer |
|
EventTimer(long seed1,
long seed2)
Creates a new EventTimer. |
Method Summary | |
double |
nextArrivalTime()
Returns a pseudo-random number in the range [0, LUNCH_TIME] |
double |
nextEatingTime()
Returns a pseudo-random number in the range [MIN_EATING_TIME, MAX_EATING_TIME] |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int MIN_EATING_TIME
public static final int MAX_EATING_TIME
public static final int LUNCH_TIME
private java.util.Random arrivalTimer
private java.util.Random eatingTimer
Constructor Detail |
public EventTimer()
public EventTimer(long seed1, long seed2)
seed1
- the seed for the arrival timerseed2
- the seed for the eating timerMethod Detail |
public double nextArrivalTime()
public double nextEatingTime()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |