Class TrainBuilderEngines

Direct Known Subclasses:
TrainBuilderCars

Contains methods for engines when building a train.
  • Constructor Details

  • Method Details

    • getAndRemoveEnginesFromList

      protected void getAndRemoveEnginesFromList()
      Builds a list of possible engines for this train.
    • addEnginesToTrain

      protected void addEnginesToTrain() throws BuildFailedException
      Adds engines to the train starting at the first location in the train's route. Note that engines from staging are already part of the train. There can be up to two engine swaps in a train's route.
      Throws:
      BuildFailedException - if required engines can't be added to train.
    • checkEngineHP

      protected void checkEngineHP() throws BuildFailedException
      Checks to see if the engine or consist assigned to the train has the appropriate HP. If the train's HP requirements are significantly higher or lower than the engine that was assigned, the program will search for a more appropriate engine or consist, and assign that engine or consist to the train. The HP calculation is based on a minimum train speed of 36 MPH. The formula HPT x 12 / % Grade = Speed, is used to determine the horsepower required. Speed is fixed at 36 MPH. For example a 1% grade requires a minimum of 3 HPT. Disabled for trains departing staging.
      Throws:
      BuildFailedException - if coding error.
    • checkNumnberOfEnginesNeededHPT

      Checks to see if additional engines are needed for the train based on the train's calculated tonnage. Minimum speed for the train is fixed at 36 MPH. The formula HPT x 12 / % Grade = Speed, is used to determine the horsepower needed. For example a 1% grade requires a minimum of 3 HPT. Ignored when departing staging
      Throws:
      BuildFailedException - if build failure