jmri.jmrit.dispatcher
Class AutoTurnouts

java.lang.Object
  extended by 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.

Author:
Dave Duchamp Copyright (C) 2008-2009

Field Summary
protected  DispatcherFrame _dispatcher
           
 
Constructor Summary
AutoTurnouts(DispatcherFrame d)
           
 
Method Summary
protected  boolean checkTurnoutsInSection(Section s, int seqNum, Section nextSection, ActiveTrain at, LayoutEditor le)
          Check that all turnouts are correctly set for travel in the designated Section to the next Section.
protected  boolean setTurnoutsInSection(Section s, int seqNum, Section nextSection, ActiveTrain at, LayoutEditor le, boolean alwaysSet)
          Set all turnouts for travel in the designated Section to the next Section.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_dispatcher

protected DispatcherFrame _dispatcher
Constructor Detail

AutoTurnouts

public AutoTurnouts(DispatcherFrame d)
Method Detail

checkTurnoutsInSection

protected boolean checkTurnoutsInSection(Section s,
                                         int seqNum,
                                         Section nextSection,
                                         ActiveTrain at,
                                         LayoutEditor le)
Check that all turnouts are correctly set for travel in the designated Section to the next Section. Returns 'true' if affected turnouts are correctly set, returns 'false' otherwise. If arguments are not valid for this Section, returns 'false', and issues an error message. NOTE: This method requires use of the connectivity stored in a Layout Editor panel.


setTurnoutsInSection

protected boolean setTurnoutsInSection(Section s,
                                       int seqNum,
                                       Section nextSection,
                                       ActiveTrain at,
                                       LayoutEditor le,
                                       boolean alwaysSet)
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. Returns 'true' if affected turnouts are correctly set or commands have been issued to set any that aren't set correctly. If a needed command could not be issued because the turnout's Block is occupied, returns 'false' and sends a warn message. If arguments are not valid for this Transit, returns 'false', and issues an error message. NOTE: This method requires use of the connectivity stored in a Layout Editor panel.



Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads