public class VehicleGenerator
extends java.lang.Object
| Constructor and Description |
|---|
VehicleGenerator()
Will use the predefined array arrivals to generate vehicles.
|
VehicleGenerator(int i)
Hard coded probabilities.
|
VehicleGenerator(java.lang.String filename)
This constructor reads the arrival and turning probabilities for different time
periods from a file.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
main(java.lang.String[] args)
Demonstration program for the VehicleGenerator
|
void |
print()
Prints the current setup of the generator
|
Vehicle |
step()
Generate a vehicle according to the probabilities for this time step
|
java.lang.String |
toString()
Returns the current state
|
public VehicleGenerator()
public VehicleGenerator(int i)
i - Not usedpublic VehicleGenerator(java.lang.String filename)
Each line of input defines the probabilities for a specific period with the
following contents
Example: The following five lines defines five periods of length 100, 20, 60, 30 and 50, respectively with different arrival and turning probabilities.
100 0.2 0.3 Night
20 0.8 0.8 Morning rush rush
60 0.5 0.5 Day
30 0.7 0.6 Afternoon rush
50 0.8 0.4 Evening
filename - name of file with probabilities (US conventions)public Vehicle step()
public java.lang.String toString()
toString in class java.lang.Objectpublic void print()
public static void main(java.lang.String[] args)
args - Not used