|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectTrainGenerator
public class TrainGenerator
This class provide methods for generating a Train. COMPLETE THIS CLASS and HAND IN THIS FILE
Config
Constructor Summary | |
---|---|
TrainGenerator()
|
Method Summary | |
---|---|
static Train |
getIncomingTrain()
Get a new train generated randomly. |
static Train |
getIncomingTrainFromFile(java.lang.String filename)
Get a new train generated from a file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TrainGenerator()
Method Detail |
---|
public static Train getIncomingTrain()
Config
.
public static Train getIncomingTrainFromFile(java.lang.String filename)
{destination},{cargo},{weight}
{destination},{cargo},{weight}
...
where {destination} is a string among Config.DEST_ARRAY, {cargo} is a string among Config.CARGO_ARRAY, and {weight} is a string for any positive integer.
Ignore the line if it is not matched in this format. See the sample in/outputs provided in the assignment description to get more details.
filename
- train input file name
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |