jmri.jmrix.powerline
Class SerialAddress

java.lang.Object
  extended by jmri.jmrix.powerline.SerialAddress

public class SerialAddress
extends Object

Utility Class supporting parsing and testing of addresses

Two address formats are supported: Gtxxx where: t is the type code, 'T' for turnouts, 'S' for sensors, and 'L' for lights xxx is a bit number of the input or output bit (1-256) examples: PT2 (House Code A, Unit 2), PS161 (House Code K, Unit 1) Gtnxx where: t is the type code, 'T' for turnouts, 'S' for sensors, and 'L' for lights n is the house code of the input or output bit (A - P) xx is a bit number of the input or output bit (1-16) examples: PTA2 (House Code A, Unit 2), PSK1 (House Code K, Unit 1)

Author:
Dave Duchamp, Copyright (C) 2004, Bob Jacobsen, Copyright (C) 2006, 2007, 2008, Ken Cameron, Copyright (C) 2008

Constructor Summary
SerialAddress()
           
 
Method Summary
static String convertSystemNameToAlternate(String systemName)
          Public static method to convert one format system name for the alternate format.
static int getBitFromSystemName(String systemName)
          Public static method to parse a system name and return the bit number Notes: Bits are numbered from 1.
static SerialNode getNodeFromSystemName(String systemName)
          Public static method to parse a system name and return the Serial Node Note: Returns 'NULL' if illegal systemName format or if the node is not found
static String normalizeSystemName(String systemName)
          Public 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.
static boolean validSystemNameConfig(String systemName, char type)
          Public static method to validate system name for configuration returns 'true' if system name has a valid meaning in current configuration, else returns 'false'
static boolean validSystemNameFormat(String systemName, char type)
          Public static method to validate system name format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerialAddress

public SerialAddress()
Method Detail

getNodeFromSystemName

public static SerialNode getNodeFromSystemName(String systemName)
Public static method to parse a system name and return the Serial Node Note: Returns 'NULL' if illegal systemName format or if the node is not found


getBitFromSystemName

public static int getBitFromSystemName(String systemName)
Public static method to parse a system name and return the bit number Notes: Bits are numbered from 1. If an error is found, 0 is returned.


validSystemNameFormat

public static boolean validSystemNameFormat(String systemName,
                                            char type)
Public static method to validate system name format

Parameters:
type - Letter indicating device type expected
Returns:
'true' if system name has a valid format, else returns 'false'

validSystemNameConfig

public static boolean validSystemNameConfig(String systemName,
                                            char type)
Public static method to validate system name for configuration returns 'true' if system name has a valid meaning in current configuration, else returns 'false'


convertSystemNameToAlternate

public static String convertSystemNameToAlternate(String systemName)
Public static method to convert one format system name for the alternate format. If the supplied system name does not have a valid format, or if there is no representation in the alternate naming scheme, an empty string is returned.


normalizeSystemName

public static String normalizeSystemName(String systemName)
Public 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.

If the supplied system name does not have a valid format, an empty string is returned. Otherwise a normalized name is returned in the same format as the input name.



Copyright © 1997 - 2008 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: SourceForge_Logo