jmri.managers
Class DefaultSignalMastLogicManager

java.lang.Object
  extended by jmri.managers.DefaultSignalMastLogicManager
All Implemented Interfaces:
Manager, SignalMastLogicManager

public class DefaultSignalMastLogicManager
extends Object
implements SignalMastLogicManager


This file is part of JMRI.

JMRI is free 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:
Kevin Dickerson Copyright (C) 2011

Field Summary
protected  PropertyChangeListener propertyBlockManagerListener
           
 
Fields inherited from interface jmri.Manager
AUDIO, BLOCKBOSS, BLOCKS, CONDITIONALS, IDTAGS, LAYOUTBLOCKS, LIGHTS, LOGIXS, MEMORIES, OBLOCKS, PANELFILES, REPORTERS, ROUTES, SECTIONS, SENSORGROUPS, SENSORS, SIGNALGROUPS, SIGNALHEADS, SIGNALMASTLOGICS, SIGNALMASTS, TIMEBASE, TRANSITS, TURNOUTS, WARRANTS
 
Constructor Summary
DefaultSignalMastLogicManager()
           
 
Method Summary
 void addDestinationMastToLogic(SignalMastLogic src, SignalMast destination)
           
 void addPropertyChangeListener(PropertyChangeListener l)
          At a minimum, subclasses must notify of changes to the list of available NamedBeans; they may have other properties that will also notify.
 void automaticallyDiscoverSignallingPairs()
          Discover all possible valid source and destination signalmasts past pairs on all layout editor panels.
 boolean checkValidDest(SignalMast sourceMast, SignalMast destMast)
          This uses the layout editor to check if the destination signalmast is reachable from the source signalmast
 void deregister(NamedBean n)
          Forget a NamedBean Object created outside the manager.
protected  void discoverSignallingDest(SignalMast source, LayoutBlock lProtecting, LayoutBlock lFacing)
           
 void discoverSignallingDest(SignalMast source, LayoutEditor layout)
          Discover valid destination signalmasts for a given source signal on a given layout editor panel.
 void dispose()
          Free resources when no longer used.
protected  void firePropertyChange(String p, Object old, Object n)
           
 NamedBean getBeanBySystemName(String systemName)
          Locate an instance based on a system name.
 ArrayList<SignalMastLogic> getLogicsByDestination(SignalMast destination)
          Gather a list of all the signal mast logics, by destination signal mast
 long getSignalLogicDelay()
           
 SignalMastLogic getSignalMastLogic(SignalMast source)
           
 ArrayList<SignalMastLogic> getSignalMastLogicList()
          Returns an arraylist of signalmastlogic
static SignalSpeedMap getSpeedMap()
           
 String[] getSystemNameArray()
           
 List<String> getSystemNameList()
           
 String getSystemPrefix()
          Provides access to the system prefix string.
 int getXMLOrder()
           
 void initialise()
          Used to initialise all the signalmast logics. primarily used after loading.
 String makeSystemName(String s)
           
 SignalMastLogic newSignalMastLogic(SignalMast source)
           
 void register(NamedBean n)
          Remember a NamedBean Object created outside the manager.
protected  void registerSelf()
          By default, register this manager to store as configuration information.
 void removeDestinationMastToLogic(SignalMastLogic src, SignalMast destination)
           
 void removePropertyChangeListener(PropertyChangeListener l)
          At a minimum, subclasses must notify of changes to the list of available NamedBeans; they may have other properties that will also notify.
 void removeSignalMastLogic(SignalMastLogic sml)
          Completely remove the signalmast logic.
 void removeSignalMastLogic(SignalMastLogic sml, SignalMast dest)
          Remove a destination mast from the signalmast logic
 void setSignalLogicDelay(long l)
           
 char systemLetter()
          Deprecated. 
 char typeLetter()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

propertyBlockManagerListener

protected PropertyChangeListener propertyBlockManagerListener
Constructor Detail

DefaultSignalMastLogicManager

public DefaultSignalMastLogicManager()
Method Detail

getXMLOrder

public int getXMLOrder()
Specified by:
getXMLOrder in interface Manager

getSpeedMap

public static final SignalSpeedMap getSpeedMap()

getSignalMastLogic

public SignalMastLogic getSignalMastLogic(SignalMast source)
Specified by:
getSignalMastLogic in interface SignalMastLogicManager

newSignalMastLogic

public SignalMastLogic newSignalMastLogic(SignalMast source)
Specified by:
newSignalMastLogic in interface SignalMastLogicManager

addDestinationMastToLogic

public void addDestinationMastToLogic(SignalMastLogic src,
                                      SignalMast destination)
Specified by:
addDestinationMastToLogic in interface SignalMastLogicManager

removeDestinationMastToLogic

public void removeDestinationMastToLogic(SignalMastLogic src,
                                         SignalMast destination)
Specified by:
removeDestinationMastToLogic in interface SignalMastLogicManager

getLogicsByDestination

public ArrayList<SignalMastLogic> getLogicsByDestination(SignalMast destination)
Gather a list of all the signal mast logics, by destination signal mast

Specified by:
getLogicsByDestination in interface SignalMastLogicManager

getSignalMastLogicList

public ArrayList<SignalMastLogic> getSignalMastLogicList()
Returns an arraylist of signalmastlogic

Specified by:
getSignalMastLogicList in interface SignalMastLogicManager
Returns:
An ArrayList of SignalMast logics

removeSignalMastLogic

public void removeSignalMastLogic(SignalMastLogic sml,
                                  SignalMast dest)
Remove a destination mast from the signalmast logic

Specified by:
removeSignalMastLogic in interface SignalMastLogicManager
Parameters:
sml - The signalmast logic of the source signal
dest - The destination mast

removeSignalMastLogic

public void removeSignalMastLogic(SignalMastLogic sml)
Completely remove the signalmast logic.

Specified by:
removeSignalMastLogic in interface SignalMastLogicManager

registerSelf

protected void registerSelf()
By default, register this manager to store as configuration information. Override to change that.


dispose

public void dispose()
Description copied from interface: Manager
Free resources when no longer used. Specifically, remove all references to and from this object, so it can be garbage-collected.

Specified by:
dispose in interface Manager
Specified by:
dispose in interface SignalMastLogicManager

initialise

public void initialise()
Used to initialise all the signalmast logics. primarily used after loading.

Specified by:
initialise in interface SignalMastLogicManager

getBeanBySystemName

public NamedBean getBeanBySystemName(String systemName)
Description copied from interface: Manager
Locate an instance based on a system name. Returns null if no instance already exists.

Specified by:
getBeanBySystemName in interface Manager
Parameters:
systemName - System Name of the required NamedBean
Returns:
requested NamedBean object or null if none exists

systemLetter

@Deprecated
public char systemLetter()
Deprecated. 

Specified by:
systemLetter in interface Manager
Returns:
The system-specific prefix letter for a specific implementation

getSystemPrefix

public String getSystemPrefix()
Description copied from interface: Manager
Provides access to the system prefix string. This was previously called the "System letter"

Specified by:
getSystemPrefix in interface Manager

typeLetter

public char typeLetter()
Specified by:
typeLetter in interface Manager
Returns:
The type letter for a specific implementation

makeSystemName

public String makeSystemName(String s)
Specified by:
makeSystemName in interface Manager
Returns:
A system name from a user input, typically a number.

getSystemNameArray

public String[] getSystemNameArray()
Specified by:
getSystemNameArray in interface Manager

getSystemNameList

public List<String> getSystemNameList()
Specified by:
getSystemNameList in interface Manager

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Description copied from interface: Manager
At a minimum, subclasses must notify of changes to the list of available NamedBeans; they may have other properties that will also notify.

Specified by:
addPropertyChangeListener in interface Manager

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Description copied from interface: Manager
At a minimum, subclasses must notify of changes to the list of available NamedBeans; they may have other properties that will also notify.

Specified by:
removePropertyChangeListener in interface Manager

firePropertyChange

protected void firePropertyChange(String p,
                                  Object old,
                                  Object n)

register

public void register(NamedBean n)
Description copied from interface: Manager
Remember a NamedBean Object created outside the manager.

The non-system-specific SignalHeadManagers use this method extensively.

Specified by:
register in interface Manager

deregister

public void deregister(NamedBean n)
Description copied from interface: Manager
Forget a NamedBean Object created outside the manager.

The non-system-specific RouteManager uses this method.

Specified by:
deregister in interface Manager

getSignalLogicDelay

public long getSignalLogicDelay()
Specified by:
getSignalLogicDelay in interface SignalMastLogicManager

setSignalLogicDelay

public void setSignalLogicDelay(long l)
Specified by:
setSignalLogicDelay in interface SignalMastLogicManager

discoverSignallingDest

public void discoverSignallingDest(SignalMast source,
                                   LayoutEditor layout)
                            throws JmriException
Discover valid destination signalmasts for a given source signal on a given layout editor panel.

Specified by:
discoverSignallingDest in interface SignalMastLogicManager
Parameters:
source - Source SignalMast
layout - Layout Editor panel to check.
Throws:
JmriException

discoverSignallingDest

protected void discoverSignallingDest(SignalMast source,
                                      LayoutBlock lProtecting,
                                      LayoutBlock lFacing)
                               throws JmriException
Throws:
JmriException

automaticallyDiscoverSignallingPairs

public void automaticallyDiscoverSignallingPairs()
                                          throws JmriException
Discover all possible valid source and destination signalmasts past pairs on all layout editor panels.

Specified by:
automaticallyDiscoverSignallingPairs in interface SignalMastLogicManager
Throws:
JmriException

checkValidDest

public boolean checkValidDest(SignalMast sourceMast,
                              SignalMast destMast)
                       throws JmriException
This uses the layout editor to check if the destination signalmast is reachable from the source signalmast

Specified by:
checkValidDest in interface SignalMastLogicManager
Parameters:
sourceMast - Source SignalMast
destMast - Destination SignalMast
Returns:
true if valid, false if not valid.
Throws:
JmriException


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