public DrivingControl getDrivingControl() {
return drivingControl;
}
public String toString() {
TrackPosition pos = null;
String out = String.format( "Train: %d, Train group: %d\n",
getId(), getTrainGroup().getId() );
pos = getHead().getPosition();
out += String.format( "Current position of head: track: %d, node: %d, away: %d\n" ,
pos.getTrack().getId(),
pos.getNode().getId(), pos.getDistance()
);
pos = getTail().getPosition();
out += String.format( "Current position of tail: track: %d, node: %d, away: %d\n",
pos.getTrack().getId(),
pos.getNode().getId(), pos.getDistance()
);
out += String.format( "Length: %d\n", getLength() );
out += String.format( "Driving direction: %s\n", ( getDirection() == DrivingControl.Direction.FORWARD ? "forward" : ( getDirection() == DrivingControl.Direction.BACKWARD ? "backward" : "undefined" ) ) );
out += String.format( "Driving mode: %s\n", drivingControl.getDrivingMode() );
out += String.format( "Total distance travelled: %d\n", getDistanceTravelled() );