Package jmri.jmrit.dispatcher
Class AutoTurnouts
- java.lang.Object
-
- jmri.jmrit.dispatcher.AutoTurnouts
-
public class AutoTurnouts extends java.lang.Object
Handles automatic checking and setting of turnouts when Dispatcher allocates a Section in a specific direction.This file is part of JMRI.
JMRI is open source software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-
Field Summary
Fields Modifier and Type Field Description protected DispatcherFrame
_dispatcher
(package private) boolean
userInformed
-
Constructor Summary
Constructors Constructor Description AutoTurnouts(DispatcherFrame d)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Turnout
checkStateAgainstList(java.util.List<LayoutTrackExpectedState<LayoutTurnout>> turnoutList)
protected java.util.List<LayoutTrackExpectedState<LayoutTurnout>>
checkTurnoutsInSection(Section s, int seqNum, Section nextSection, ActiveTrain at, Section prevSection)
Check that all turnouts are correctly set for travel in the designated Section to the next Section.protected java.util.List<LayoutTrackExpectedState<LayoutTurnout>>
setTurnoutsInSection(Section s, int seqNum, Section nextSection, ActiveTrain at, boolean trustKnownTurnouts, Section prevSection)
Set all turnouts for travel in the designated Section to the next Section.
-
-
-
Field Detail
-
_dispatcher
protected DispatcherFrame _dispatcher
-
userInformed
boolean userInformed
-
-
Constructor Detail
-
AutoTurnouts
public AutoTurnouts(DispatcherFrame d)
-
-
Method Detail
-
checkTurnoutsInSection
protected java.util.List<LayoutTrackExpectedState<LayoutTurnout>> checkTurnoutsInSection(Section s, int seqNum, Section nextSection, ActiveTrain at, Section prevSection)
Check that all turnouts are correctly set for travel in the designated Section to the next Section. NOTE: This method requires use of the connectivity stored in a Layout Editor panel. NOTE: This method removes the need to specify the LayoutEditor panel.- Parameters:
s
- the section to checkseqNum
- sequence number for the sectionnextSection
- the following sectionat
- the associated trainprevSection
- the prior section- Returns:
- list of turnouts and their expected states if affected turnouts are correctly set; null otherwise.
-
setTurnoutsInSection
protected java.util.List<LayoutTrackExpectedState<LayoutTurnout>> setTurnoutsInSection(Section s, int seqNum, Section nextSection, ActiveTrain at, boolean trustKnownTurnouts, Section prevSection)
Set all turnouts for travel in the designated Section to the next Section. Checks that all turnouts are correctly set for travel in this Section to the next Section, and sets any turnouts that are not correct. The Section must be FREE to set its turnouts. Testing for FREE only occurs if a command needs to be issued. For a command to be issued to set a turnout, the Block containing that turnout must be unoccupied. NOTE: This method does not wait for turnout feedback--it assumes the turnout will be set correctly if a command is issued. NOTE: This method removes the need to specify the LayoutEditor panel.- Parameters:
s
- the section to checkseqNum
- sequence number for the sectionnextSection
- the following sectionat
- the associated traintrustKnownTurnouts
- true to trust known turnoutsprevSection
- the prior section- Returns:
- list of turnouts and their expected states if affected turnouts are correctly set or commands have been issued to set any that aren't set correctly; null if a needed command could not be issued because the turnout's Block is occupied
-
checkStateAgainstList
protected Turnout checkStateAgainstList(java.util.List<LayoutTrackExpectedState<LayoutTurnout>> turnoutList)
-
-