TSim
Class TrainEvent
java.lang.Object
|
+--TSim.TrainEvent
- public class TrainEvent
- extends java.lang.Object
- implements TSimInformation
Class representing an (erroneous) event for a train.
Constructor Summary |
TrainEvent(int trainId,
int event)
Creates a new TrainEvent for the specified train id and with
the specified event type. |
Method Summary |
int |
getEvent()
Returns the type of the event. |
int |
getTrainId()
Returns the id of the train affected byt the event. |
java.lang.String |
toString()
Returns a string representation of the event. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
TRAIN_COLLISION
public static final int TRAIN_COLLISION
STOP_COLLISION
public static final int STOP_COLLISION
DERAILMENT
public static final int DERAILMENT
event
protected int event
trainId
protected int trainId
TrainEvent
public TrainEvent(int trainId,
int event)
- Creates a new TrainEvent for the specified train id and with
the specified event type.
- Parameters:
trainId
- the id of the train affected by the event.event
- the type of the event.
getEvent
public int getEvent()
- Returns the type of the event.
- Returns:
- the type of the event.
getTrainId
public int getTrainId()
- Returns the id of the train affected byt the event.
- Returns:
- the id of the train effected by the event.
toString
public java.lang.String toString()
- Returns a string representation of the event. This is used when
creating exception messages.
- Overrides:
- toString in class java.lang.Object
- Returns:
- the string representation of the event.