Package jmri.jmrix.oaktree
Class SerialAddress
java.lang.Object
jmri.jmrix.oaktree.SerialAddress
Utility Class supporting parsing and testing of addresses.
Two address formats are supported:
- Otnnnxxx where:
- t is the type code: 'T' for turnouts, 'S' for sensors, and 'L' for lights
- nnn is the node address (0-127)
- xxx is a bit number of the input or output bit (001-999)
- nnxxx = (node address x 1000) + bit number
- OtnnnBxxxx where:
- t is the type code: 'T' for turnouts, 'S' for sensors, and 'L' for lights
- nnn is the node address of the input or output bit (0-127)
- xxxx is a bit number of the input or output bit (1-2048)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringconvertSystemNameToAlternate(String systemName, String prefix) Static method to convert one format system name for the alternate format.static intgetBitFromSystemName(String systemName, String prefix) Static method to parse a system name and return the bit number.static SerialNodegetNodeFromSystemName(String systemName, SerialTrafficController tc) Static method to parse a system name and return the Serial Node.static StringnormalizeSystemName(String systemName, String prefix) Static method to normalize a system name.static StringvalidateSystemNameFormat(String systemName, String prefix, Locale locale) Validate system name format.static booleanvalidSystemNameConfig(String systemName, char type, OakTreeSystemConnectionMemo memo) Static method to validate system name for configuration.static Manager.NameValidityvalidSystemNameFormat(String systemName, char type, String prefix) Static method to validate system name format.
-
Field Details
-
_memo
-
-
Constructor Details
-
SerialAddress
-
-
Method Details
-
getNodeFromSystemName
Static method to parse a system name and return the Serial Node.- Parameters:
systemName- system name.tc- traffic controller.- Returns:
- 'NULL' if illegal systemName format or if the node is not found
-
getBitFromSystemName
Static method to parse a system name and return the bit number. Note: Bits are numbered from 1.- Parameters:
systemName- system name.prefix- system prefix.- Returns:
- 0 if an error is found
-
validateSystemNameFormat
public static String validateSystemNameFormat(String systemName, String prefix, Locale locale) throws IllegalArgumentException Validate system name format. Does not check whether that node is defined on current system.- Parameters:
systemName- the system nameprefix- the prefix fromManager.getSystemNamePrefix()locale- the Locale for user messages- Returns:
- systemName unmodified
- Throws:
IllegalArgumentException- if unable to validate systemName
-
validSystemNameFormat
public static Manager.NameValidity validSystemNameFormat(@Nonnull String systemName, char type, String prefix) Static method to validate system name format.- Parameters:
systemName- system name.type- Letter indicating device type expectedprefix- system prefix.- Returns:
- 'true' if system name has a valid format, else returns 'false'
-
validSystemNameConfig
public static boolean validSystemNameConfig(String systemName, char type, OakTreeSystemConnectionMemo memo) Static method to validate system name for configuration.- Parameters:
systemName- system name.type- bean type, e.g. S for Sensor, T for Turnout.memo- system connection.- Returns:
- 'true' if system name has a valid meaning in current configuration, else return 'false'
-
convertSystemNameToAlternate
Static method to convert one format system name for the alternate format.- Parameters:
systemName- system name.prefix- system prefix.- Returns:
- an empty string if the supplied system name does not have a valid format, or if there is no representation in the alternate naming scheme
-
normalizeSystemName
Static method to normalize a system name.This routine is used to ensure that each system name is uniquely linked to one bit, by removing extra zeros inserted by the user.
- Parameters:
systemName- system name.prefix- system prefix.- Returns:
- an empty string if the supplied system name does not have a valid format. Otherwise a normalized name is returned in the same format as the input name.
-