Package jmri.managers
Class DefaultSignalMastLogicManager
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.beans.VetoableChangeSupport
-
- jmri.managers.AbstractManager<SignalMastLogic>
-
- jmri.managers.DefaultSignalMastLogicManager
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.beans.VetoableChangeListener
,java.util.EventListener
,PropertyChangeFirer
,PropertyChangeProvider
,SilenceablePropertyChangeProvider
,VetoableChangeFirer
,VetoableChangeProvider
,Manager<SignalMastLogic>
,SignalMastLogicManager
public class DefaultSignalMastLogicManager extends AbstractManager<SignalMastLogic> implements SignalMastLogicManager
Default implementation of a SignalMastLogicManager.- See Also:
SignalMastLogicManager
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.Manager
Manager.ManagerDataEvent<E extends NamedBean>, Manager.ManagerDataListener<E extends NamedBean>, Manager.NameValidity
-
-
Field Summary
Fields Modifier and Type Field Description protected java.beans.PropertyChangeListener
propertyBlockManagerListener
(package private) boolean
runWhenStablised
(package private) int
signalLogicDelay
-
Fields inherited from class jmri.managers.AbstractManager
_beans, _tsys, _tuser, lastAutoNamedBeanRef, memo, paddedNumber, silenceableProperties, silencedProperties
-
Fields inherited from class jmri.beans.VetoableChangeSupport
vetoableChangeSupport
-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
Fields inherited from interface jmri.Manager
ANALOGIOS, AUDIO, BLOCKBOSS, BLOCKS, CONDITIONALS, CTCDATA, ENTRYEXIT, IDTAGS, LAYOUTBLOCKS, LIGHTS, LOGIXNG_ANALOG_ACTIONS, LOGIXNG_ANALOG_EXPRESSIONS, LOGIXNG_CONDITIONALNGS, LOGIXNG_DIGITAL_ACTIONS, LOGIXNG_DIGITAL_BOOLEAN_ACTIONS, LOGIXNG_DIGITAL_EXPRESSIONS, LOGIXNG_GLOBAL_VARIABLES, LOGIXNG_MODULES, LOGIXNG_STRING_ACTIONS, LOGIXNG_STRING_EXPRESSIONS, LOGIXNG_TABLES, LOGIXNGS, LOGIXS, MEMORIES, METERFRAMES, METERS, OBLOCKS, PANELFILES, REPORTERS, ROUTES, SECTIONS, SENSORGROUPS, SENSORS, SIGNALGROUPS, SIGNALHEADS, SIGNALMASTLOGICS, SIGNALMASTS, STRINGIOS, TIMEBASE, TRANSITS, TURNOUTS, WARRANTS
-
-
Constructor Summary
Constructors Constructor Description DefaultSignalMastLogicManager(InternalSystemConnectionMemo memo)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addListeners()
void
automaticallyDiscoverSignallingPairs()
Discover all possible valid source + destination signal mast pairs on all Layout Editor Panels.void
disableLayoutEditorUse(SignalMast mast)
Disable the use of info from the Layout Editor Panels to configure a Signal Mast Logic for a specific Signal Mast.void
discoverSignallingDest(SignalMast source, LayoutEditor layout)
Discover valid destination Signal Masts for a given source Signal Mast on a given Layout Editor Panel.void
dispose()
Free resources when no longer used.void
generateSection()
Populate Sections of type SIGNALMASTLOGIC used with Layout Editor with Signal Mast attributes as stored in Signal Mast Logic.java.lang.String
getBeanTypeHandled(boolean plural)
Get the user-readable name of the type of NamedBean handled by this manager.java.util.List<SignalMastLogic>
getLogicsByDestination(SignalMast destination)
Gather a list of all the Signal Mast Logics, by destination Signal Mast.java.lang.Class<SignalMastLogic>
getNamedBeanClass()
Get the class of NamedBean supported by this Manager.int
getSignalLogicDelay()
SignalMastLogic
getSignalMastLogic(SignalMast source)
Return the Signal Mast Logic for a specific Source Signal Mast.java.util.List<SignalMastLogic>
getSignalMastLogicList()
Return a list of all existing Signal Mast Logicsstatic SignalSpeedMap
getSpeedMap()
int
getXMLOrder()
Determine the order that types should be written when storing panel files.void
initialise()
Initialise all the Signal Mast Logics.boolean
isSignalMastUsed(SignalMast mast)
Check if a Signal Mast is in use as either a Source or Destination mast in any Signal Mast LogicSignalMastLogic
newSignalMastLogic(SignalMast source)
Provide / create New SML.void
removeSignalMast(SignalMast mast)
Completely remove a Signal Mast from all the SMLs that use it.void
removeSignalMastLogic(SignalMastLogic sml)
Completely remove a specific Signal Mast Logic by name.void
removeSignalMastLogic(SignalMastLogic sml, SignalMast dest)
Remove a destination Signal Mast and its settings from a Signal Mast Logic.void
removeSignalMastsDirectionSensors()
Iterate over the signal masts setting up direction Section sensors.void
replaceSignalMast(SignalMast oldMast, SignalMast newMast)
Replace all instances of an old SignalMast (either source or destination) with the new signal mast instance.void
setSignalLogicDelay(int l)
int
setupSignalMastsDirectionSensors()
Iterate over the signal masts setting up direction Section sensors.void
swapSignalMasts(SignalMast mastA, SignalMast mastB)
Replace the complete Signal Mast Logic configurations between two Source Signal Masts.char
typeLetter()
-
Methods inherited from class jmri.managers.AbstractManager
addDataListener, checkNumeric, createSystemName, deleteBean, deregister, fireDataListenersAdded, fireDataListenersRemoved, fireVetoableChange, getAutoSystemName, getBySystemName, getBySystemName, getByUserName, getKnownBeanProperties, getMemo, getNamedBean, getNamedBeanSet, getObjectCount, getOuterBean, getSystemPrefix, handleUserNameUniqueness, makeSystemName, propertyChange, register, registerSelf, registerUserName, removeDataListener, setDataListenerMute, setPropertyChangesSilenced, setRegisterSelf, updateAutoNumber, validSystemNameFormat, vetoableChange
-
Methods inherited from class jmri.beans.VetoableChangeSupport
addVetoableChangeListener, addVetoableChangeListener, fireVetoableChange, fireVetoableChange, fireVetoableChange, getVetoableChangeListeners, getVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jmri.Manager
addDataListener, deleteBean, deregister, getBeanTypeHandled, getBySystemName, getByUserName, getEntryToolTip, getKnownBeanProperties, getMemo, getNamedBean, getNamedBeanSet, getObjectCount, getSubSystemNamePrefix, getSystemNamePrefix, getSystemPrefix, isValidSystemNameFormat, makeSystemName, makeSystemName, makeSystemName, register, removeDataListener, setDataListenerMute, validateBadCharsInSystemNameFormat, validateIntegerSystemNameFormat, validateNmraAccessorySystemNameFormat, validateSystemNameFormat, validateSystemNameFormat, validateSystemNameFormatOnlyNumeric, validateSystemNamePrefix, validateTrimmedMin1NumberSystemNameFormat, validateTrimmedSystemNameFormat, validateUppercaseTrimmedSystemNameFormat, validSystemNameFormat
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from interface jmri.beans.SilenceablePropertyChangeProvider
setPropertyChangesSilenced
-
Methods inherited from interface jmri.beans.VetoableChangeProvider
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
-
-
-
Field Detail
-
signalLogicDelay
int signalLogicDelay
-
propertyBlockManagerListener
protected java.beans.PropertyChangeListener propertyBlockManagerListener
-
runWhenStablised
boolean runWhenStablised
-
-
Constructor Detail
-
DefaultSignalMastLogicManager
public DefaultSignalMastLogicManager(InternalSystemConnectionMemo memo)
-
-
Method Detail
-
addListeners
final void addListeners()
-
getXMLOrder
public int getXMLOrder()
Determine the order that types should be written when storing panel files. Uses one of the constants defined in this class.Yes, that's an overly-centralized methodology, but it works for now.
- Specified by:
getXMLOrder
in interfaceManager<SignalMastLogic>
- Returns:
- write order for this Manager; larger is later.
-
getSpeedMap
public static final SignalSpeedMap getSpeedMap()
-
getSignalMastLogic
public SignalMastLogic getSignalMastLogic(SignalMast source)
Return the Signal Mast Logic for a specific Source Signal Mast.- Specified by:
getSignalMastLogic
in interfaceSignalMastLogicManager
- Parameters:
source
- The Source Signal Mast- Returns:
- The Signal Mast Logic for that mast
-
newSignalMastLogic
@Nonnull public SignalMastLogic newSignalMastLogic(SignalMast source) throws java.lang.IllegalArgumentException
Provide / create New SML. Create a new Signal Mast Logic for a source Signal Mast.- Specified by:
newSignalMastLogic
in interfaceSignalMastLogicManager
- Parameters:
source
- The source Signal Mast- Returns:
- source The new SML instance
- Throws:
java.lang.IllegalArgumentException
-
replaceSignalMast
public void replaceSignalMast(SignalMast oldMast, SignalMast newMast)
Replace all instances of an old SignalMast (either source or destination) with the new signal mast instance. This is for use with such tools as the Layout Editor where a signal mast at a certain location can be replaced with another, while the remainder of the configuration stays the same.- Specified by:
replaceSignalMast
in interfaceSignalMastLogicManager
- Parameters:
oldMast
- Current Signal MastnewMast
- Replacement (new) Signal Mast
-
swapSignalMasts
public void swapSignalMasts(SignalMast mastA, SignalMast mastB)
Replace the complete Signal Mast Logic configurations between two Source Signal Masts.- Specified by:
swapSignalMasts
in interfaceSignalMastLogicManager
- Parameters:
mastA
- Signal Mast AmastB
- Signal Mast B
-
getLogicsByDestination
@Nonnull public java.util.List<SignalMastLogic> getLogicsByDestination(SignalMast destination)
Gather a list of all the Signal Mast Logics, by destination Signal Mast.- Specified by:
getLogicsByDestination
in interfaceSignalMastLogicManager
- Parameters:
destination
- The destination Signal Mast- Returns:
- a list of logics for destination or an empty list if none
-
getSignalMastLogicList
@Nonnull public java.util.List<SignalMastLogic> getSignalMastLogicList()
Return a list of all existing Signal Mast Logics- Specified by:
getSignalMastLogicList
in interfaceSignalMastLogicManager
- Returns:
- An List of all Signal Mast Logics
-
isSignalMastUsed
public boolean isSignalMastUsed(@Nonnull SignalMast mast)
Check if a Signal Mast is in use as either a Source or Destination mast in any Signal Mast Logic- Specified by:
isSignalMastUsed
in interfaceSignalMastLogicManager
- Parameters:
mast
- the signal mast to check- Returns:
- true if mast is used by at least one Signal Mast Logic
-
removeSignalMastLogic
public void removeSignalMastLogic(SignalMastLogic sml, SignalMast dest)
Remove a destination Signal Mast and its settings from a Signal Mast Logic.- Specified by:
removeSignalMastLogic
in interfaceSignalMastLogicManager
- Parameters:
sml
- The Signal Mast Logicdest
- The destination mast
-
removeSignalMastLogic
public void removeSignalMastLogic(SignalMastLogic sml)
Completely remove a specific Signal Mast Logic by name.- Specified by:
removeSignalMastLogic
in interfaceSignalMastLogicManager
- Parameters:
sml
- The Signal Mast Logic to be removed
-
removeSignalMast
public void removeSignalMast(SignalMast mast)
Completely remove a Signal Mast from all the SMLs that use it.- Specified by:
removeSignalMast
in interfaceSignalMastLogicManager
- Parameters:
mast
- The Signal Mast to be removed
-
disableLayoutEditorUse
public void disableLayoutEditorUse(SignalMast mast)
Disable the use of info from the Layout Editor Panels to configure a Signal Mast Logic for a specific Signal Mast.- Specified by:
disableLayoutEditorUse
in interfaceSignalMastLogicManager
- Parameters:
mast
- The Signal Mast for which LE info is to be disabled
-
initialise
public void initialise()
Initialise all the Signal Mast Logics. Primarily used after loading a configuration.- Specified by:
initialise
in interfaceSignalMastLogicManager
-
typeLetter
public char typeLetter()
- Specified by:
typeLetter
in interfaceManager<SignalMastLogic>
- Returns:
- The type letter for a specific implementation
-
getSignalLogicDelay
public int getSignalLogicDelay()
- Specified by:
getSignalLogicDelay
in interfaceSignalMastLogicManager
- Returns:
- characteristic delay time in msec, used to control roughly when signal system computations are done. (Some are half this, some twice)
-
setSignalLogicDelay
public void setSignalLogicDelay(int l)
- Specified by:
setSignalLogicDelay
in interfaceSignalMastLogicManager
- Parameters:
l
- characteristic delay time in msec, used to control roughly when signal system computations are done. (Some are half this, some twice)
-
discoverSignallingDest
public void discoverSignallingDest(SignalMast source, LayoutEditor layout) throws JmriException
Discover valid destination Signal Masts for a given source Signal Mast on a given Layout Editor Panel.- Specified by:
discoverSignallingDest
in interfaceSignalMastLogicManager
- Parameters:
source
- Source SignalMastlayout
- Layout Editor panel to check.- Throws:
JmriException
- if there is an error discovering signaling destinations
-
automaticallyDiscoverSignallingPairs
public void automaticallyDiscoverSignallingPairs() throws JmriException
Discover all possible valid source + destination signal mast pairs on all Layout Editor Panels.- Specified by:
automaticallyDiscoverSignallingPairs
in interfaceSignalMastLogicManager
- Throws:
JmriException
- if there is an error discovering signaling pairs
-
generateSection
public void generateSection()
Populate Sections of type SIGNALMASTLOGIC used with Layout Editor with Signal Mast attributes as stored in Signal Mast Logic.
-
getBeanTypeHandled
public java.lang.String getBeanTypeHandled(boolean plural)
Get the user-readable name of the type of NamedBean handled by this manager.For instance, in the code where we are dealing with just a bean and a message that needs to be passed to the user or in a log.
- Specified by:
getBeanTypeHandled
in interfaceManager<SignalMastLogic>
- Parameters:
plural
- true to return plural form of the type; false to return singular form- Returns:
- a string of the bean type that the manager handles, eg Turnout, Sensor etc
-
getNamedBeanClass
public java.lang.Class<SignalMastLogic> getNamedBeanClass()
Get the class of NamedBean supported by this Manager. This should be the generic class used in the Manager's class declaration.- Specified by:
getNamedBeanClass
in interfaceManager<SignalMastLogic>
- Returns:
- the class supported by this Manager.
-
setupSignalMastsDirectionSensors
public int setupSignalMastsDirectionSensors()
Iterate over the signal masts setting up direction Section sensors.- Specified by:
setupSignalMastsDirectionSensors
in interfaceSignalMastLogicManager
- Returns:
- error count
-
removeSignalMastsDirectionSensors
public void removeSignalMastsDirectionSensors()
Iterate over the signal masts setting up direction Section sensors.- Specified by:
removeSignalMastsDirectionSensors
in interfaceSignalMastLogicManager
-
dispose
public void dispose()
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 interfaceManager<SignalMastLogic>
- Specified by:
dispose
in interfaceSignalMastLogicManager
- Overrides:
dispose
in classAbstractManager<SignalMastLogic>
-
-