Class TrainBuilderCars

    • Method Detail

      • getCaboose

        protected void getCaboose​(java.lang.String roadCaboose,
                                  Engine leadEngine,
                                  RouteLocation rl,
                                  RouteLocation rld,
                                  boolean requiresCaboose)
                           throws BuildFailedException
        Find a caboose if needed at the correct location and add it to the train. If departing staging, all cabooses are added to the train. If there isn't a road name required for the caboose, tries to find a caboose with the same road name as the lead engine.
        Parameters:
        roadCaboose - Optional road name for this car.
        leadEngine - The lead engine for this train. Used to find a caboose with the same road name as the engine.
        rl - Where in the route to pick up this car.
        rld - Where in the route to set out this car.
        requiresCaboose - When true, the train requires a caboose.
        Throws:
        BuildFailedException - If car not found.
      • getCarWithFred

        protected void getCarWithFred​(java.lang.String road,
                                      RouteLocation rl,
                                      RouteLocation rld)
                               throws BuildFailedException
        Find a car with FRED if needed at the correct location and adds the car to the train. If departing staging, will make sure all cars with FRED are added to the train.
        Parameters:
        road - Optional road name for this car.
        rl - Where in the route to pick up this car.
        rld - Where in the route to set out this car.
        Throws:
        BuildFailedException - If car not found.
      • blockCarsFromStaging

        protected void blockCarsFromStaging()
                                     throws BuildFailedException
        Optionally block cars departing staging. No guarantee that cars departing staging can be blocked by destination. By using the pick up location id, this routine tries to find destinations that are willing to accepts all of the cars that were "blocked" together when they were picked up. Rules: The route must allow set outs at the destination. The route must allow the correct number of set outs. The destination must accept all cars in the pick up block.
        Throws:
        BuildFailedException - if blocking fails
      • findDestinationsForCarsFromLocation

        protected void findDestinationsForCarsFromLocation​(RouteLocation rl,
                                                           boolean isSecondPass)
                                                    throws BuildFailedException
        Attempts to find a destinations for cars departing a specific route location.
        Parameters:
        rl - The route location where cars need destinations.
        isSecondPass - When true this is the second time we've looked at these cars. Used to perform local moves.
        Throws:
        BuildFailedException - if failure