Interface MemoryManager
-
- All Superinterfaces:
Manager<Memory>
,PropertyChangeProvider
,ProvidingManager<Memory>
,SilenceablePropertyChangeProvider
,VetoableChangeProvider
- All Known Implementing Classes:
AbstractMemoryManager
,DefaultMemoryManager
public interface MemoryManager extends ProvidingManager<Memory>
Locate a Memory object representing some specific information.Memory objects are obtained from a MemoryManager, which in turn is generally located from the InstanceManager. A typical call sequence might be:
Memory memory = InstanceManager.memoryManagerInstance().provideMemory("status");
Each Memory has two names. The "user" name is entirely free form, and can be used for any purpose. The "system" name is provided by the system-specific implementations, if any, and provides a unique mapping to the layout control system (for example LocoNet or NCE) and address within that system. Note that most (all?) layout systems don't have anything corresponding to this, in which case the "Internal" Memory objects are still available with names like IM23.
Much of the bookkeeping is implemented in the
AbstractMemoryManager
class, which can form the basis for a system-specific implementation.- See Also:
Memory
,AbstractMemoryManager
,InstanceManager
-
-
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 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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Memory
getBySystemName(java.lang.String systemName)
Locate an existing Memory based on a system name.Memory
getByUserName(java.lang.String userName)
Locate an existing Memory based on a user name.Memory
getMemory(java.lang.String name)
Get an existing Turnout or return null if it doesn't exist.Memory
newMemory(java.lang.String userName)
For use with User GUI, to allow the auto generation of systemNames, where the user can optionally supply a username.Memory
newMemory(java.lang.String systemName, java.lang.String userName)
Return a Memory with the specified system and user names.Memory
provideMemory(java.lang.String name)
Get the Memory with the user name, then system name if needed; if that fails, create a new Memory.-
Methods inherited from interface jmri.Manager
addDataListener, deleteBean, deregister, dispose, getBeanTypeHandled, getBeanTypeHandled, getEntryToolTip, getKnownBeanProperties, getMemo, getNamedBean, getNamedBeanClass, getNamedBeanSet, getObjectCount, getSubSystemNamePrefix, getSystemNamePrefix, getSystemPrefix, getXMLOrder, isValidSystemNameFormat, makeSystemName, makeSystemName, makeSystemName, register, removeDataListener, setDataListenerMute, typeLetter, 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.ProvidingManager
provide
-
Methods inherited from interface jmri.beans.SilenceablePropertyChangeProvider
setPropertyChangesSilenced
-
Methods inherited from interface jmri.beans.VetoableChangeProvider
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
-
-
-
Method Detail
-
provideMemory
@Nonnull Memory provideMemory(@Nonnull java.lang.String name) throws java.lang.IllegalArgumentException
Get the Memory with the user name, then system name if needed; if that fails, create a new Memory. If the name is a valid system name, it will be used for the new Memory. Otherwise, the makeSystemName method will attempt to turn it into a valid system name.- Parameters:
name
- User name, system name, or address which can be promoted to system name- Returns:
- Never null
- Throws:
java.lang.IllegalArgumentException
- if Memory doesn't already exist and the manager cannot create the Memory due to an illegal name or name that can't be parsed.
-
getMemory
@CheckForNull Memory getMemory(@Nonnull java.lang.String name)
Get an existing Turnout or return null if it doesn't exist. Locates via user name, then system name if needed.- Parameters:
name
- User name or system name to match- Returns:
- null if no match found
-
getBySystemName
@CheckForNull Memory getBySystemName(@Nonnull java.lang.String systemName)
Locate an existing Memory based on a system name. Returns null if no instance already exists.- Specified by:
getBySystemName
in interfaceManager<Memory>
- Parameters:
systemName
- the system name- Returns:
- requested Memory object or null if none exists
-
getByUserName
@CheckForNull Memory getByUserName(@Nonnull java.lang.String userName)
Locate an existing Memory based on a user name. Returns null if no instance already exists.- Specified by:
getByUserName
in interfaceManager<Memory>
- Parameters:
userName
- the user name- Returns:
- requested Memory object or null if none exists
-
newMemory
@Nonnull Memory newMemory(@Nonnull java.lang.String systemName, @CheckForNull java.lang.String userName) throws java.lang.IllegalArgumentException
Return a Memory with the specified system and user names. Note that two calls with the same arguments will get the same instance; there is only one Memory object representing a given physical Memory and therefore only one with a specific system or user name.This will always return a valid object reference; a new object will be created if necessary. In that case:
- If a null reference is given for user name, no user name will be associated with the Memory object created; a valid system name must be provided
- If both names are provided, the system name defines the hardware access of the desired Memory, and the user address is associated with it. The system name must be valid.
- Parameters:
systemName
- the system nameuserName
- the user name- Returns:
- requested Memory object (never null)
- Throws:
java.lang.IllegalArgumentException
- if cannot create the Memory due to e.g. an illegal name or name that can't be parsed.
-
newMemory
@Nonnull Memory newMemory(@CheckForNull java.lang.String userName) throws java.lang.IllegalArgumentException
For use with User GUI, to allow the auto generation of systemNames, where the user can optionally supply a username.This will always return a valid object reference; a new object will be created if necessary.
- Parameters:
userName
- the user name, can be null- Returns:
- requested Memory object (never null)
- Throws:
java.lang.IllegalArgumentException
- if cannot create the Memory due to e.g. an illegal name or name that can't be parsed.
-
-