Class DefaultConditionalManager
- All Implemented Interfaces:
PropertyChangeListener
,VetoableChangeListener
,EventListener
,PropertyChangeFirer
,PropertyChangeProvider
,SilenceablePropertyChangeProvider
,VetoableChangeFirer
,VetoableChangeProvider
,ConditionalManager
,Manager<Conditional>
public class DefaultConditionalManager extends AbstractManager<Conditional> implements ConditionalManager
Note that Conditionals always have an associated parent Logix.
Logix system names must begin with IX, and be followed by a string, usually, but not always, a number. The system names of Conditionals always begin with the parent Logix's system name, then there is a capital C and a number.
Conditional system names are set automatically when the Conditional is
created. All alphabetic characters in a Conditional system name must be upper
case. This is enforced when a new Conditional is created via
LogixTableAction
Conditional user names have specific requirements that are
addressed in the Conditional
class.
-
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 inherited from class jmri.managers.AbstractManager
_beans, _tsys, _tuser, lastAutoNamedBeanRef, memo, paddedNumber, silenceableProperties, silencedProperties
Fields inherited from interface jmri.Manager
ANALOGIOS, AUDIO, BLOCKBOSS, BLOCKS, CONDITIONALS, CTCDATA, deprecatedManagerLogger, ENTRYEXIT, IDTAGS, LAYOUTBLOCKS, LIGHTS, LOGIXNG_ANALOG_ACTIONS, LOGIXNG_ANALOG_EXPRESSIONS, LOGIXNG_CONDITIONALNGS, LOGIXNG_DIGITAL_ACTIONS, LOGIXNG_DIGITAL_BOOLEAN_ACTIONS, LOGIXNG_DIGITAL_EXPRESSIONS, 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 DefaultConditionalManager(InternalSystemConnectionMemo memo)
-
Method Summary
Modifier and Type Method Description void
addWhereUsed(String target, String reference)
Add a conditional reference to the array indicated by the target system name.Conditional
createNewConditional(String systemName, String userName)
Method to create a new Conditional if the Conditional does not exist If the parent Logix cannot be found, the userName cannot be checked, but the Conditional is still created.void
deleteConditional(Conditional c)
Remove an existing Conditional.void
displayWhereUsed()
Display the complete structure, used for debugging purposes.String
getBeanTypeHandled(boolean plural)
Get the user-readable name of the type of NamedBean handled by this manager.Conditional
getBySystemName(String name)
Locate an existing instance based on a system name.Conditional
getByUserName(String key)
Locate an existing instance based on a user name.Conditional
getByUserName(Logix x, String key)
Conditional
getConditional(String name)
Conditional
getConditional(Logix x, String name)
Method to get an existing Conditional.Class<Conditional>
getNamedBeanClass()
Get the class of NamedBean supported by this Manager.SortedSet<Conditional>
getNamedBeanSet()
Create a named bean set for conditionals.Logix
getParentLogix(String name)
Parses the Conditional system name to get the parent Logix system name, then gets the parent Logix, and returns it.List<String>
getSystemNameList()
Deprecated.4.11.5 - use direct access viagetNamedBeanSet()
List<String>
getSystemNameListForLogix(Logix x)
Get a list of all Conditional system names with the specified Logix parentArrayList<String>
getTargetList(String reference)
Get the target system names used by this conditionalArrayList<String>
getWhereUsed(String target)
Get a list of conditional references for the indicated conditionalHashMap<String,ArrayList<String>>
getWhereUsedMap()
Return a copy of the entire map.int
getXMLOrder()
Determine the order that types should be written when storing panel files.protected void
handleUserNameUniqueness(Conditional s)
Do not insist that Conditional user names are unique, unlike the usual NamedBean supportstatic DefaultConditionalManager
instance()
Deprecated.since 4.17.3; useInstanceManager.getDefault(java.lang.Class)
insteadvoid
removeWhereUsed(String target, String reference)
Remove a conditional reference from the array indicated by the target system name.char
typeLetter()
Methods inherited from class jmri.managers.AbstractManager
addDataListener, checkNumeric, createSystemName, deleteBean, deregister, dispose, fireDataListenersAdded, fireDataListenersRemoved, fireVetoableChange, getAutoSystemName, getBySystemName, getIncrement, getIncrementFromExistingNumber, getInstanceBySystemName, getInstanceByUserName, getKnownBeanProperties, getMemo, getNamedBean, getNamedBeanList, getNextValidAddress, getNextValidAddress, getObjectCount, getSystemPrefix, makeSystemName, propertyChange, register, registerSelf, registerUserName, removeDataListener, setDataListenerMute, setPropertyChangesSilenced, 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, getBeanBySystemName, getBeanByUserName, getBeanTypeHandled, getEntryToolTip, getKnownBeanProperties, getMemo, getNamedBean, getNamedBeanList, getObjectCount, getSubSystemNamePrefix, getSystemNamePrefix, getSystemPrefix, isValidSystemNameFormat, makeSystemName, makeSystemName, makeSystemName, register, removeDataListener, setDataListenerMute, setPropertyChangesMuted, 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
-
Constructor Details
-
Method Details
-
getXMLOrder
Description copied from interface:Manager
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<Conditional>
- Returns:
- write order for this Manager; larger is later.
-
typeLetter
- Specified by:
typeLetter
in interfaceManager<Conditional>
- Returns:
- The type letter for a specific implementation
-
createNewConditional
Method to create a new Conditional if the Conditional does not exist If the parent Logix cannot be found, the userName cannot be checked, but the Conditional is still created. The scenario can happen when a Logix is loaded from a file after its Conditionals.- Specified by:
createNewConditional
in interfaceConditionalManager
- Parameters:
systemName
- properly formatted system name for the new ConditionaluserName
- must not be null, use "" instead- Returns:
- null if a Conditional with the same systemName or userName already exists, or if there is trouble creating a new Conditional
-
handleUserNameUniqueness
Do not insist that Conditional user names are unique, unlike the usual NamedBean support- Overrides:
handleUserNameUniqueness
in classAbstractManager<Conditional>
- Parameters:
s
- the bean to register
-
getParentLogix
Parses the Conditional system name to get the parent Logix system name, then gets the parent Logix, and returns it. For sensor groups, the parent Logix name is 'SYS'. LRoutes and exported Routes (RTX prefix) require special logic- Specified by:
getParentLogix
in interfaceConditionalManager
- Parameters:
name
- system name of Conditionals- Returns:
- the parent Logix or null
-
deleteConditional
Remove an existing Conditional. Parent Logix must have been deactivated before invoking this.- Specified by:
deleteConditional
in interfaceConditionalManager
- Parameters:
c
- the conditional to remove
-
getConditional
Method to get an existing Conditional. First looks up assuming that name is a User Name. Note: the parent Logix must be passed in x for user name lookup. If this fails, or if x == null, looks up assuming that name is a System Name. If both fail, returns null.- Specified by:
getConditional
in interfaceConditionalManager
- Parameters:
x
- parent Logix (may be null)name
- name to look up- Returns:
- null if no match found
-
getConditional
- Specified by:
getConditional
in interfaceConditionalManager
-
getByUserName
Description copied from class:AbstractManager
Locate an existing instance based on a user name.- Specified by:
getByUserName
in interfaceConditionalManager
- Specified by:
getByUserName
in interfaceManager<Conditional>
- Overrides:
getByUserName
in classAbstractManager<Conditional>
- Parameters:
key
- System Name of the required NamedBean- Returns:
- requested NamedBean object or null if none exists
-
getByUserName
- Specified by:
getByUserName
in interfaceConditionalManager
-
getBySystemName
Description copied from class:AbstractManager
Locate an existing instance based on a system name.- Specified by:
getBySystemName
in interfaceConditionalManager
- Specified by:
getBySystemName
in interfaceManager<Conditional>
- Overrides:
getBySystemName
in classAbstractManager<Conditional>
- Parameters:
name
- System Name of the required NamedBean- Returns:
- requested NamedBean object or null if none exists
-
getSystemNameListForLogix
Get a list of all Conditional system names with the specified Logix parent- Specified by:
getSystemNameListForLogix
in interfaceConditionalManager
- Parameters:
x
- the logix- Returns:
- a list of Conditional system names
-
getSystemNameList
Deprecated.4.11.5 - use direct access viagetNamedBeanSet()
Get a list of all Conditional system names Overrides the bean method- Specified by:
getSystemNameList
in interfaceManager<Conditional>
- Overrides:
getSystemNameList
in classAbstractManager<Conditional>
- Returns:
- a list of conditional system names regardless of parent Logix
- Since:
- 4.7.4
-
getNamedBeanSet
Create a named bean set for conditionals. This requires special logic since conditional beans are not registered.- Specified by:
getNamedBeanSet
in interfaceManager<Conditional>
- Overrides:
getNamedBeanSet
in classAbstractManager<Conditional>
- Returns:
- a sorted named bean set of conditionals.
- Since:
- 4.17.5
-
instance
Deprecated.since 4.17.3; useInstanceManager.getDefault(java.lang.Class)
instead- Returns:
- the default instance of the DefaultConditionalManager
-
getBeanTypeHandled
Description copied from interface:Manager
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<Conditional>
- 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
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<Conditional>
- Returns:
- the class supported by this Manager.
-
getWhereUsedMap
Return a copy of the entire map. Used byLogixTableAction.buildWhereUsedListing()
- Specified by:
getWhereUsedMap
in interfaceConditionalManager
- Returns:
- a copy of the map
- Since:
- 4.7.4
-
addWhereUsed
Add a conditional reference to the array indicated by the target system name.- Specified by:
addWhereUsed
in interfaceConditionalManager
- Parameters:
target
- The system name for the target conditionalreference
- The system name of the conditional that contains the conditional reference- Since:
- 4.7.4
-
getWhereUsed
Get a list of conditional references for the indicated conditional- Specified by:
getWhereUsed
in interfaceConditionalManager
- Parameters:
target
- The target conditional for a conditional reference- Returns:
- an ArrayList or null if none
- Since:
- 4.7.4
-
removeWhereUsed
Remove a conditional reference from the array indicated by the target system name.- Specified by:
removeWhereUsed
in interfaceConditionalManager
- Parameters:
target
- The system name for the target conditionalreference
- The system name of the conditional that contains the conditional reference- Since:
- 4.7.4
-
displayWhereUsed
Display the complete structure, used for debugging purposes.- Specified by:
displayWhereUsed
in interfaceConditionalManager
- Since:
- 4.7.4
-
getTargetList
Get the target system names used by this conditional- Specified by:
getTargetList
in interfaceConditionalManager
- Parameters:
reference
- The system name of the conditional the refers to other conditionals.- Returns:
- a list of the target conditionals
- Since:
- 4.7.4
-