Package jmri.jmrit.operations.router
Class Router
java.lang.Object
jmri.jmrit.operations.trains.trainbuilder.TrainCommon
jmri.jmrit.operations.router.Router
- All Implemented Interfaces:
InstanceManagerAutoDefault
Router for car movement. This code attempts to find a way (a route) to move a
car to its final destination through the use of two or more trains. First the
code tries to move car using a single train. If that fails, attempts are made
using two trains via a classification/interchange (C/I) tracks, then yard
tracks if enabled. Next attempts are made using three or more trains using
any combination of C/I and yard tracks. If that fails and routing via staging
is enabled, the code tries two trains using staging tracks, then multiple
trains using a combination of C/I, yards, and staging tracks. Currently the
router is limited to seven trains.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) PrintWriter(package private) Dateprotected static final Stringprotected static final Stringstatic final Stringprotected static final String(package private) TrainManagerFields inherited from class jmri.jmrit.operations.trains.trainbuilder.TrainCommon
_dropCars, _pickupCars, BLANK_LINE, BUILD_REPORT_CHAR, carManager, ENGINE, engineManager, HORIZONTAL_LINE_CHAR, HYPHEN, IS_MANIFEST, IS_TWO_COLUMN_TRACK, LOCAL, locationManager, NEW_LINE, PAPER_MARGINS, PICKUP, SPACE, TAB, TEXT_COLOR_DONE, TEXT_COLOR_END, TEXT_COLOR_START, VERTICAL_LINE_CHAR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the status of the router when using the setDestination() for a car.booleanisCarRouteable(Car car, Train train, Location destination, Track track, PrintWriter buildReport) booleanisCarRouteable(Car car, Train train, Track track, PrintWriter buildReport) Determines if car can be routed to the destination trackbooleansetDestination(Car car, Train train, PrintWriter buildReport) Attempts to set the car's destination if a final destination exists.Methods inherited from class jmri.jmrit.operations.trains.trainbuilder.TrainCommon
addCarsLocationUnknown, addLine, addLine, blockCarsByTrack, blockCarsByTrackNameTwoColumn, blockCarsTwoColumn, blockLocosTwoColumn, clearUtilityCarTypes, convertStringTime, convertStringToDate, countPickupUtilityCars, countSetoutUtilityCars, countUtilityCars, createTabIfNeeded, dropCar, dropCar, dropEngine, dropEngines, formatColorString, formatStringToCommaSeparated, getDate, getDate, getDropCarHeader, getDropEngineHeader, getISO8601Date, getLineLength, getLocalMoveHeader, getManifestHeaderLineLength, getPageSize, getPickupCarHeader, getPickupEngineHeader, getSwitchListTrainStatus, getTextColor, getTextColorName, getTextColorString, getTrainMessage, isNextCar, isNextCar, isThereWorkAtLocation, isThereWorkAtLocation, localMoveCar, newLine, newLine, padAndTruncate, padAndTruncateIfNeeded, padString, pickupCar, pickUpCar, pickUpCarTruncated, pickupEngine, pickupEngines, pickupUtilityCars, pickupUtilityCars, printCarHeader, printDropCarHeader, printDropEngineHeader, printEngineHeader, printHorizontalLine, printHorizontalLine, printHorizontalLine1, printHorizontalLine2, printHorizontalLine3, printLocalCarMoveHeader, printPickupCarHeader, printPickupEngineHeader, printTrackComments, printTrackNameHeader, setCarPickupAndSetoutTimes, setoutUtilityCars, setoutUtilityCars, setoutUtilityCars, splitString, splitStringLeftParenthesis, tabString, truncatedDropCar
-
Field Details
-
tmanager
-
_nextLocationTracks
-
_lastLocationTracks
-
_next2ndLocationTracks
-
_next3rdLocationTracks
-
_next4thLocationTracks
-
_nextLocationTrains
-
_lastLocationTrains
-
_excludeTrains
-
_listTrains
-
STATUS_NOT_THIS_TRAIN
-
STATUS_NOT_THIS_TRAIN_PREFIX
-
STATUS_NOT_ABLE
-
STATUS_ROUTER_DISABLED
-
_buildReport
-
_startTime
-
-
Constructor Details
-
Router
public Router()
-
-
Method Details
-
getStatus
Returns the status of the router when using the setDestination() for a car.- Returns:
- Track.OKAY, STATUS_NOT_THIS_TRAIN, STATUS_NOT_ABLE, STATUS_ROUTER_DISABLED, or the destination track status is there's an issue.
-
isCarRouteable
Determines if car can be routed to the destination track- Parameters:
car- the car being testedtrain- the first train servicing the car, can be nulltrack- the destination track, can not be nullbuildReport- the report, can be null- Returns:
- true if the car can be routed to the track
-
isCarRouteable
public boolean isCarRouteable(Car car, Train train, Location destination, Track track, PrintWriter buildReport) -
setDestination
Attempts to set the car's destination if a final destination exists. Only sets the car's destination if the train is part of the car's route.- Parameters:
car- the car to routetrain- the first train to carry this car, can be nullbuildReport- PrintWriter for build report, and can be null- Returns:
- true if car can be routed.
-