Class AutoTurnouts

java.lang.Object
jmri.jmrit.dispatcher.AutoTurnouts

public class AutoTurnouts
extends 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 Details

  • Constructor Details

  • Method Details

    • checkTurnoutsInSection

      protected boolean checkTurnoutsInSection​(Section s, int seqNum, Section nextSection, ActiveTrain at, LayoutEditor le, 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.
      Parameters:
      s - the section to check
      seqNum - sequence number for the section
      nextSection - the following section
      at - the associated train
      le - the associated layout panel
      prevSection - the prior section
      Returns:
      true if affected turnouts are correctly set; false otherwise.
    • setTurnoutsInSection

      protected boolean setTurnoutsInSection​(Section s, int seqNum, Section nextSection, ActiveTrain at, LayoutEditor le, 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 requires use of the connectivity stored in a Layout Editor panel.
      Parameters:
      s - the section to check
      seqNum - sequence number for the section
      nextSection - the following section
      at - the associated train
      le - the associated layout panel
      trustKnownTurnouts - true to trust known turnouts
      prevSection - the prior section
      Returns:
      true if affected turnouts are correctly set or commands have been issued to set any that aren't set correctly; false if a needed command could not be issued because the turnout's Block is occupied