Package jmri.jmrix.anyma
Class AnymaDMX_SystemConnectionMemo
- java.lang.Object
-
- jmri.beans.UnboundBean
-
- jmri.beans.Bean
-
- jmri.jmrix.DefaultSystemConnectionMemo
-
- jmri.jmrix.anyma.AnymaDMX_SystemConnectionMemo
-
- All Implemented Interfaces:
BeanInterface
,PropertyChangeFirer
,PropertyChangeProvider
,Disposable
,ConfiguringSystemConnectionMemo
,SystemConnectionMemo
public class AnymaDMX_SystemConnectionMemo extends DefaultSystemConnectionMemo implements ConfiguringSystemConnectionMemo
Minimal SystemConnectionMemo for anyma dmx systems.- Since:
- 4.9.6
-
-
Field Summary
-
Fields inherited from class jmri.jmrix.DefaultSystemConnectionMemo
classObjectMap
-
Fields inherited from class jmri.beans.Bean
propertyChangeSupport
-
Fields inherited from interface jmri.SystemConnectionMemo
DEREGISTER, DISABLED, INTERVAL, STORE, SYSTEM_PREFIX, USER_NAME
-
-
Constructor Summary
Constructors Constructor Description AnymaDMX_SystemConnectionMemo()
constructorAnymaDMX_SystemConnectionMemo(java.lang.String prefix, java.lang.String userName)
constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
checkSystemPrefix(java.lang.String systemName)
Public static method to check and skip the System Prefix string on a system name.void
configureManagers()
Configure the common managers for anyma dmx connections.java.lang.String
convertSystemNameToAlternate(java.lang.String systemName)
Public static method to convert one format anyma dmx system name to the alternate format.void
dispose()
dispose<T> T
get(java.lang.Class<T> T)
Get a manager for a specific type.protected java.util.ResourceBundle
getActionModelResourceBundle()
get the action model resource bundleint
getChannelFromSystemName(java.lang.String systemName)
Public static method to parse a anyma dmx system name and return the channel number.UsbLightManager
getLightManager()
get the LightManager<B extends NamedBean>
java.util.Comparator<B>getNamedBeanComparator(java.lang.Class<B> type)
Get the Comparator to be used for two NamedBeans.int
getNodeAddressFromSystemName(java.lang.String systemName)
Public static method to parse a anyma dmx system name and return the Usb Node Addressprotected AnymaDMX_TrafficController
getTrafficController()
get the traffic controllerjava.lang.String
getUserNameFromSystemName(java.lang.String systemName)
public method to get the user name for a valid system nameboolean
provides(java.lang.Class<?> c)
Check if this connection provides a specific manager type.protected void
setTrafficController(AnymaDMX_TrafficController trafficController)
set the traffic controllerboolean
validSystemNameConfig(java.lang.String systemName, char type)
Public static method to validate anyma dmx system name for configuration.Manager.NameValidity
validSystemNameFormat(java.lang.String systemName, char type)
Public static method to validate system name format.-
Methods inherited from class jmri.jmrix.DefaultSystemConnectionMemo
deregister, getActionFactory, getConsistManager, getDefaultOutputInterval, getDisabled, getOutputInterval, getSystemPrefix, getUserName, isDirty, isRestartRequired, register, setConsistManager, setDisabled, setOutputInterval, setSystemPrefix, setUserName, store
-
Methods inherited from class jmri.beans.Bean
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, isNotifyOnEDT, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from class jmri.beans.UnboundBean
getIndexedProperty, getProperty, getPropertyNames, hasIndexedProperty, hasProperty, setIndexedProperty, setProperty
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from interface jmri.SystemConnectionMemo
getActionFactory, getDefaultOutputInterval, getDisabled, getOutputInterval, getSystemPrefix, getUserName, isDirty, isRestartRequired, register, setDisabled, setOutputInterval, setSystemPrefix, setUserName
-
-
-
-
Constructor Detail
-
AnymaDMX_SystemConnectionMemo
public AnymaDMX_SystemConnectionMemo()
constructor
-
AnymaDMX_SystemConnectionMemo
public AnymaDMX_SystemConnectionMemo(@Nonnull java.lang.String prefix, @Nonnull java.lang.String userName)
constructor.- Parameters:
prefix
- system prefix.userName
- system username.
-
-
Method Detail
-
getTrafficController
protected AnymaDMX_TrafficController getTrafficController()
get the traffic controller- Returns:
- the traffic controller
-
setTrafficController
protected void setTrafficController(AnymaDMX_TrafficController trafficController)
set the traffic controller- Parameters:
trafficController
- the traffic controller
-
getUserNameFromSystemName
public java.lang.String getUserNameFromSystemName(java.lang.String systemName)
public method to get the user name for a valid system name- Parameters:
systemName
- the system name- Returns:
- "" (null string) if system name is not valid or does not exist
-
getChannelFromSystemName
public int getChannelFromSystemName(java.lang.String systemName)
Public static method to parse a anyma dmx system name and return the channel number. Notes:- Channels are numbered from 1 to 512.
- Does not check whether that node is defined on current system.
- Parameters:
systemName
- system name.- Returns:
- 0 if an error is found.
-
checkSystemPrefix
public int checkSystemPrefix(java.lang.String systemName)
Public static method to check and skip the System Prefix string on a system name.- Parameters:
systemName
- system name string.- Returns:
- offset of the 1st character past the prefix, or -1 if not valid for this connection
-
convertSystemNameToAlternate
public java.lang.String convertSystemNameToAlternate(java.lang.String systemName)
Public static method to convert one format anyma dmx system name to the alternate format.- Parameters:
systemName
- system name string.- Returns:
- "" (empty string) if the supplied system name does not have a valid format, or if there is no representation in the alternate naming scheme
-
validSystemNameFormat
public Manager.NameValidity validSystemNameFormat(@Nonnull java.lang.String systemName, char type)
Public static method to validate system name format. Does not check whether that node is defined on current system.- Parameters:
systemName
- proposed system name.type
- bean type, only L supported.- Returns:
- enum indicating current validity, which might be just as a prefix
-
validSystemNameConfig
public boolean validSystemNameConfig(java.lang.String systemName, char type)
Public static method to validate anyma dmx system name for configuration. Does validate node number and system prefix.- Parameters:
systemName
- anya dmx systemName.type
- bean type, only L supported.- Returns:
- 'true' if system name has a valid meaning in current configuration, else returns 'false'.
-
getNodeAddressFromSystemName
public int getNodeAddressFromSystemName(java.lang.String systemName)
Public static method to parse a anyma dmx system name and return the Usb Node AddressNodes are numbered from 0 - 127. Does not check whether that node is defined on current system.
- Parameters:
systemName
- system name.- Returns:
- '-1' if invalid systemName format or if the node is not found.
-
provides
public boolean provides(java.lang.Class<?> c)
Check if this connection provides a specific manager type. This method must return false if a manager for the specific type is not provided, and must return true if a manager for the specific type is provided.- Specified by:
provides
in interfaceSystemConnectionMemo
- Overrides:
provides
in classDefaultSystemConnectionMemo
- Parameters:
c
- The class type for the manager to be provided- Returns:
- true if the specified manager is provided
- See Also:
DefaultSystemConnectionMemo.get(java.lang.Class)
-
get
public <T> T get(java.lang.Class<T> T)
Get a manager for a specific type. This method must return a non-null value ifDefaultSystemConnectionMemo.provides(java.lang.Class)
is true for the type, and must return null if provides() is false for the type.- Specified by:
get
in interfaceSystemConnectionMemo
- Overrides:
get
in classDefaultSystemConnectionMemo
- Type Parameters:
T
- Type of manager to get- Parameters:
T
- Type of manager to get- Returns:
- The manager or null if provides() is false for T
- See Also:
DefaultSystemConnectionMemo.provides(java.lang.Class)
-
configureManagers
public void configureManagers()
Configure the common managers for anyma dmx connections. This puts the common manager config in one place.- Specified by:
configureManagers
in interfaceConfiguringSystemConnectionMemo
-
getLightManager
public UsbLightManager getLightManager()
get the LightManager- Returns:
- the LightManager
-
getActionModelResourceBundle
protected java.util.ResourceBundle getActionModelResourceBundle()
get the action model resource bundle- Specified by:
getActionModelResourceBundle
in classDefaultSystemConnectionMemo
- Returns:
- the ResourceBundle
-
getNamedBeanComparator
public <B extends NamedBean> java.util.Comparator<B> getNamedBeanComparator(java.lang.Class<B> type)
Description copied from class:DefaultSystemConnectionMemo
Get the Comparator to be used for two NamedBeans. This is typically anNamedBeanComparator
, but may be any Comparator that works for this connection type.- Specified by:
getNamedBeanComparator
in interfaceSystemConnectionMemo
- Specified by:
getNamedBeanComparator
in classDefaultSystemConnectionMemo
- Type Parameters:
B
- the type of NamedBean- Parameters:
type
- the class of NamedBean- Returns:
- the Comparator
-
dispose
public void dispose()
dispose- Specified by:
dispose
in interfaceDisposable
- Specified by:
dispose
in interfaceSystemConnectionMemo
- Overrides:
dispose
in classDefaultSystemConnectionMemo
-
-