TSim
Class SensorEvent

java.lang.Object
  |
  +--TSim.SensorEvent

public class SensorEvent
extends java.lang.Object
implements TSimInformation

SensorEvent represents the event of a train passing over a sensor. Every time a train passes over a sensor first an ACTIVE event is created followed by an INACTIVE event when the train leaves the sensor.


Field Summary
static int ACTIVE
           
static int INACTIVE
           
protected  int status
           
protected  int trainId
           
protected  int xPos
           
protected  int yPos
           
 
Constructor Summary
SensorEvent(int trainId, int xPos, int yPos, int status)
          Creates a new SensorEvent for a specific train and sensor.
 
Method Summary
 int getStatus()
          Returns the status of the sensor; either ACTIVE or INACTIVE.
 int getTrainId()
          Returns the id of the train affectng the sensor.
 int getXpos()
          Returns the x coordinate of the affected sensor.
 int getYpos()
          Returns theyx coordinate of the affected sensor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTIVE

public static final int ACTIVE

INACTIVE

public static final int INACTIVE

trainId

protected int trainId

status

protected int status

xPos

protected int xPos

yPos

protected int yPos
Constructor Detail

SensorEvent

public SensorEvent(int trainId,
                   int xPos,
                   int yPos,
                   int status)
Creates a new SensorEvent for a specific train and sensor. The train is represented by the trainId and the sensor by its coordinates.
Parameters:
trainId - the id of the train passing the sensor.
xPos - the x coordinate of the sensor.
yPos - the y coordinate of the sensor.
status - the status of the sensor; either ACTIVE or INACTIVE/
Method Detail

getXpos

public int getXpos()
Returns the x coordinate of the affected sensor.
Returns:
the x coordinate of the affected sensor.

getYpos

public int getYpos()
Returns theyx coordinate of the affected sensor.
Returns:
the y coordinate of the affected sensor.

getStatus

public int getStatus()
Returns the status of the sensor; either ACTIVE or INACTIVE.
Returns:
the status of the sensor.

getTrainId

public int getTrainId()
Returns the id of the train affectng the sensor.
Returns:
the id of the train affecting the sensor.