Class TrainBuilder

    • Method Detail

      • build

        public boolean build​(Train train)
        Build rules:
        1. Need at least one location in route to build train
        2. Select only locos and cars that the train can service
        3. If required, add caboose or car with FRED to train
        4. When departing staging find a track matching train requirements
        5. All cars and locos on one track must leave staging
        6. Optionally block cars from staging
        7. Route cars with home divisions
        8. Route cars with custom loads or final destinations.
        9. Service locations based on train direction, location car types, roads and loads.
        10. Ignore track direction when train is a local (serves one location)

        History:

        First version of train builder found cars along a train's route and assigned destinations (tracks) willing to accept the car. This is called the random method as cars just bounce around the layout without purpose. Afterwards custom loads and routing was added to the program. Cars with custom loads or final destinations move with purpose as those cars are routed. The last major feature added was car divisions. Cars assigned a division are always routed.

        The program was written around the concept of a build report. The report provides a description of the train build process and the steps taken to place rolling stock in a train. The goal was to help users understand why rolling stock was either assigned to the train or not, and which choices the program had available when determining an engine's or car's destination.

        Parameters:
        train - the train that is to be built
        Returns:
        True if successful.