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 (package private) intsignalLogicDelay-
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, PROPERTY_BEANS, PROPERTY_CAN_DELETE, PROPERTY_DISPLAY_LIST_NAME, PROPERTY_DO_DELETE, PROPERTY_DO_NOT_DELETE, PROPERTY_LENGTH, REPORTERS, ROUTES, SECTIONS, SENSORGROUPS, SENSORS, SIGNALGROUPS, SIGNALHEADS, SIGNALMASTLOGICS, SIGNALMASTS, STRINGIOS, TIMEBASE, TRANSITS, TURNOUTS, WARRANTS
-
Fields inherited from interface jmri.SignalMastLogicManager
PROPERTY_AUTO_GENERATE_COMPLETE, PROPERTY_AUTO_GENERATE_UPDATE, PROPERTY_AUTO_SIGNALMAST_GENERATE_COMPLETE, PROPERTY_AUTO_SIGNALMAST_GENERATE_START
-
-
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) voidaddListeners()voidautomaticallyDiscoverSignallingPairs()Discover all possible valid source + destination signal mast pairs on all Layout Editor Panels.voiddisableLayoutEditorUse(SignalMast mast)Disable the use of info from the Layout Editor Panels to configure a Signal Mast Logic for a specific Signal Mast.voiddiscoverSignallingDest(SignalMast source, LayoutEditor layout)Discover valid destination Signal Masts for a given source Signal Mast on a given Layout Editor Panel.voiddispose()Free resources when no longer used.voidgenerateSection()Populate Sections of type SIGNALMASTLOGIC used with Layout Editor with Signal Mast attributes as stored in Signal Mast Logic.java.lang.StringgetBeanTypeHandled(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.intgetSignalLogicDelay()SignalMastLogicgetSignalMastLogic(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 SignalSpeedMapgetSpeedMap()intgetXMLOrder()Determine the order that types should be written when storing panel files.voidinitialise()Initialise all the Signal Mast Logics.booleanisSignalMastUsed(SignalMast mast)Check if a Signal Mast is in use as either a Source or Destination mast in any Signal Mast LogicSignalMastLogicnewSignalMastLogic(SignalMast source)Provide / create New SML.voidremoveSignalMast(SignalMast mast)Completely remove a Signal Mast from all the SMLs that use it.voidremoveSignalMastLogic(SignalMastLogic sml)Completely remove a specific Signal Mast Logic by name.voidremoveSignalMastLogic(SignalMastLogic sml, SignalMast dest)Remove a destination Signal Mast and its settings from a Signal Mast Logic.voidremoveSignalMastsDirectionSensors()Iterate over the signal masts setting up direction Section sensors.voidreplaceSignalMast(SignalMast oldMast, SignalMast newMast)Replace all instances of an old SignalMast (either source or destination) with the new signal mast instance.voidsetSignalLogicDelay(int l)intsetupSignalMastsDirectionSensors()Iterate over the signal masts setting up direction Section sensors.voidswapSignalMasts(SignalMast mastA, SignalMast mastB)Replace the complete Signal Mast Logic configurations between two Source Signal Masts.chartypeLetter()-
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
-
-
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:
getXMLOrderin interfaceManager<SignalMastLogic>- Returns:
- write order for this Manager; larger is later.
-
getSpeedMap
public static final SignalSpeedMap getSpeedMap()
-
getSignalMastLogic
@CheckForNull public SignalMastLogic getSignalMastLogic(SignalMast source)
Return the Signal Mast Logic for a specific Source Signal Mast.- Specified by:
getSignalMastLogicin interfaceSignalMastLogicManager- Parameters:
source- The Source Signal Mast- Returns:
- The Signal Mast Logic for that mast
-
newSignalMastLogic
@Nonnull public SignalMastLogic newSignalMastLogic(@Nonnull SignalMast source) throws java.lang.IllegalArgumentException
Provide / create New SML. Create a new Signal Mast Logic for a source Signal Mast.- Specified by:
newSignalMastLogicin interfaceSignalMastLogicManager- Parameters:
source- The source Signal Mast- Returns:
- source The new SML instance
- Throws:
java.lang.IllegalArgumentException- when needed
-
replaceSignalMast
public void replaceSignalMast(@Nonnull SignalMast oldMast, @Nonnull 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:
replaceSignalMastin interfaceSignalMastLogicManager- Parameters:
oldMast- Current Signal MastnewMast- Replacement (new) Signal Mast
-
swapSignalMasts
public void swapSignalMasts(@Nonnull SignalMast mastA, @Nonnull SignalMast mastB)
Replace the complete Signal Mast Logic configurations between two Source Signal Masts.- Specified by:
swapSignalMastsin interfaceSignalMastLogicManager- Parameters:
mastA- Signal Mast AmastB- Signal Mast B
-
getLogicsByDestination
@Nonnull public java.util.List<SignalMastLogic> getLogicsByDestination(@Nonnull SignalMast destination)
Gather a list of all the Signal Mast Logics, by destination Signal Mast.- Specified by:
getLogicsByDestinationin 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:
getSignalMastLogicListin 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:
isSignalMastUsedin 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(@Nonnull SignalMastLogic sml, @Nonnull SignalMast dest)
Remove a destination Signal Mast and its settings from a Signal Mast Logic.- Specified by:
removeSignalMastLogicin interfaceSignalMastLogicManager- Parameters:
sml- The Signal Mast Logicdest- The destination mast
-
removeSignalMastLogic
public void removeSignalMastLogic(@Nonnull SignalMastLogic sml)
Completely remove a specific Signal Mast Logic by name.- Specified by:
removeSignalMastLogicin interfaceSignalMastLogicManager- Parameters:
sml- The Signal Mast Logic to be removed
-
removeSignalMast
public void removeSignalMast(@Nonnull SignalMast mast)
Completely remove a Signal Mast from all the SMLs that use it.- Specified by:
removeSignalMastin interfaceSignalMastLogicManager- Parameters:
mast- The Signal Mast to be removed
-
disableLayoutEditorUse
public void disableLayoutEditorUse(@Nonnull 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:
disableLayoutEditorUsein 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:
initialisein interfaceSignalMastLogicManager
-
typeLetter
public char typeLetter()
- Specified by:
typeLetterin interfaceManager<SignalMastLogic>- Returns:
- The type letter for a specific implementation
-
getSignalLogicDelay
public int getSignalLogicDelay()
- Specified by:
getSignalLogicDelayin 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:
setSignalLogicDelayin 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(@Nonnull SignalMast source, @Nonnull LayoutEditor layout) throws JmriException
Discover valid destination Signal Masts for a given source Signal Mast on a given Layout Editor Panel.- Specified by:
discoverSignallingDestin 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:
automaticallyDiscoverSignallingPairsin 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:
getBeanTypeHandledin 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:
getNamedBeanClassin 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:
setupSignalMastsDirectionSensorsin interfaceSignalMastLogicManager- Returns:
- error count
-
removeSignalMastsDirectionSensors
public void removeSignalMastsDirectionSensors()
Iterate over the signal masts setting up direction Section sensors.- Specified by:
removeSignalMastsDirectionSensorsin 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:
disposein interfaceManager<SignalMastLogic>- Specified by:
disposein interfaceSignalMastLogicManager- Overrides:
disposein classAbstractManager<SignalMastLogic>
-
-