Package jmri.jmrit.logix
Class WarrantManager
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.beans.VetoableChangeSupport
-
- jmri.managers.AbstractManager<Warrant>
-
- jmri.jmrit.logix.WarrantManager
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener,java.beans.VetoableChangeListener,java.util.EventListener,PropertyChangeFirer,PropertyChangeProvider,SilenceablePropertyChangeProvider,VetoableChangeFirer,VetoableChangeProvider,InstanceManagerAutoDefault,Manager<Warrant>
public class WarrantManager extends AbstractManager<Warrant> implements InstanceManagerAutoDefault
Basic Implementation of a WarrantManager.Note this is a concrete 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, memo, 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
-
-
Constructor Summary
Constructors Constructor Description WarrantManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description WarrantcreateNewWarrant(java.lang.String systemName, java.lang.String userName, boolean sCWa, long tTP)Method to create a new Warrant if it does not exist.voiddispose()Free resources when no longer used.java.lang.StringgetBeanTypeHandled(boolean plural)Get the user-readable name of the type of NamedBean handled by this manager.static WarrantManagergetDefault()Get the default WarrantManager.protected RosterSpeedProfilegetMergeProfile(java.lang.String id)Return a copy of the RosterSpeedProfile for Roster entryprotected java.util.HashMap<java.lang.String,RosterSpeedProfile>getMergeProfiles()java.lang.Class<Warrant>getNamedBeanClass()Get the class of NamedBean supported by this Manager.WarrantgetWarrant(java.lang.String name)Method to get an existing Warrant.intgetXMLOrder()Determine the order that types should be written when storing panel files.protected RosterSpeedProfilemakeProfileCopy(RosterSpeedProfile mergeProfile, RosterEntry re)protected booleanokToRemoveBlock(OBlock block)protected booleanokToRemoveBlockPath(OBlock block, OPath path)protected booleanokToRemovePortal(Portal portal)protected voidpathNameChange(OBlock block, java.lang.String oldName, java.lang.String newName)protected voidportalNameChange(java.lang.String oldName, java.lang.String newName)WarrantprovideWarrant(java.lang.String name)protected voidsetMergeProfile(java.lang.String id, RosterSpeedProfile merge)protected java.util.List<NamedBean>signalsUsing(Portal portal)chartypeLetter()protected java.util.List<Warrant>warrantsUsing(OBlock block)protected java.util.List<Warrant>warrantsUsing(OBlock block, OPath path)protected java.util.List<Warrant>warrantsUsing(Portal portal)-
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, 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
getBeanTypeHandled, getEntryToolTip, getSubSystemNamePrefix, getSystemNamePrefix, isValidSystemNameFormat, makeSystemName, makeSystemName, validateBadCharsInSystemNameFormat, validateIntegerSystemNameFormat, validateNmraAccessorySystemNameFormat, validateSystemNameFormat, validateSystemNameFormat, validateSystemNameFormatOnlyNumeric, validateSystemNamePrefix, validateTrimmedMin1NumberSystemNameFormat, validateTrimmedSystemNameFormat, validateUppercaseTrimmedSystemNameFormat
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from interface jmri.beans.VetoableChangeProvider
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
-
-
-
Constructor Detail
-
WarrantManager
public WarrantManager()
-
-
Method Detail
-
getXMLOrder
public int getXMLOrder()
Description copied from interface:ManagerDetermine 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<Warrant>- Returns:
- write order for this Manager; larger is later.
-
typeLetter
public char typeLetter()
- Specified by:
typeLetterin interfaceManager<Warrant>- Returns:
- The type letter for a specific implementation
-
createNewWarrant
public Warrant createNewWarrant(java.lang.String systemName, java.lang.String userName, boolean sCWa, long tTP)
Method to create a new Warrant if it does not exist.Returns null if a Warrant with the same systemName or userName already exists, or if there is trouble creating a new Warrant.
- Parameters:
systemName- the system name.userName- the user name.sCWa- true for a new SCWarrant, false for a new Warrant.tTP- the time to platform.- Returns:
- an existing warrant if found or a new warrant, may be null.
-
getWarrant
public Warrant getWarrant(java.lang.String name)
Method to get an existing Warrant. First looks up assuming that name is a User Name. If this fails looks up assuming that name is a System Name. If both fail, returns null.- Parameters:
name- the system name or user name- Returns:
- the warrant if found or null
-
provideWarrant
public Warrant provideWarrant(java.lang.String name)
-
okToRemoveBlock
protected boolean okToRemoveBlock(@Nonnull OBlock block)
-
okToRemovePortal
protected boolean okToRemovePortal(Portal portal)
-
okToRemoveBlockPath
protected boolean okToRemoveBlockPath(OBlock block, OPath path)
-
portalNameChange
protected void portalNameChange(java.lang.String oldName, java.lang.String newName)
-
warrantsUsing
protected java.util.List<Warrant> warrantsUsing(OBlock block)
-
warrantsUsing
protected java.util.List<Warrant> warrantsUsing(Portal portal)
-
signalsUsing
protected java.util.List<NamedBean> signalsUsing(Portal portal)
-
warrantsUsing
protected java.util.List<Warrant> warrantsUsing(OBlock block, OPath path)
-
pathNameChange
protected void pathNameChange(OBlock block, java.lang.String oldName, java.lang.String newName)
-
getDefault
public static WarrantManager getDefault()
Get the default WarrantManager.- Returns:
- the default WarrantManager, creating it if necessary
-
getBeanTypeHandled
@Nonnull public java.lang.String getBeanTypeHandled(boolean plural)
Description copied from interface:ManagerGet 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<Warrant>- 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<Warrant> 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<Warrant>- Returns:
- the class supported by this Manager.
-
setMergeProfile
protected void setMergeProfile(java.lang.String id, RosterSpeedProfile merge)
-
getMergeProfile
protected RosterSpeedProfile getMergeProfile(java.lang.String id)
Return a copy of the RosterSpeedProfile for Roster entry- Parameters:
id- roster id- Returns:
- RosterSpeedProfile
-
makeProfileCopy
protected RosterSpeedProfile makeProfileCopy(@CheckForNull RosterSpeedProfile mergeProfile, @Nonnull RosterEntry re)
-
getMergeProfiles
protected java.util.HashMap<java.lang.String,RosterSpeedProfile> getMergeProfiles()
-
dispose
public void dispose()
Description copied from class:AbstractManagerFree resources when no longer used. Specifically, remove all references to and from this object, so it can be garbage-collected.
-
-