Package net.sf.mrailsim.rails

Examples of net.sf.mrailsim.rails.TrackPosition


  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() );
View Full Code Here


      e.printStackTrace();
      System.exit( 2 );
    }
   
    train.setPositions(
        new TrackPosition( track, headsNode, 0 ),
        new TrackPosition( track, node, track.getLength() - train.getLength() ) );

    track.trainEnters( train, null );
  }
View Full Code Here

TOP

Related Classes of net.sf.mrailsim.rails.TrackPosition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.