jmri.jmrix.maple
Class SerialAddress

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

public class SerialAddress
extends Object

Utility Class supporting parsing and testing of addresses

Two address formats are supported: Ktxxxx where: t is the type code, 'T' for turnouts, 'S' for sensors, and 'L' for lights xxxx is a bit number of the input or output bit (001-9999) Note: with Maple, all panels (nodes) have the same address space, so there is no node number in the address.

Author:
Dave Duchamp, Copyright (C) 2004 - 2009

Constructor Summary
SerialAddress()
           
 
Method Summary
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 String getUserNameFromSystemName(String systemName)
          Public static method to the user name for a valid system name Returns "" (null string) if the system name is not valid or does not exist
static String isInputBitFree(int bitNum)
          Public static method to test if a input bit is free for assignment Returns "" (null string) if the specified input bit is free for assignment, else returns the system name of the conflicting assignment.
static String isOutputBitFree(int bitNum)
          Public static method to test if a output bit is free for assignment Returns "" (null string) if the specified output bit is free for assignment, else returns the system name of the conflicting assignment.
static String makeSystemName(String type, int bitNum)
          Public static method to construct a system name from type character and bit number This routine returns a system name in the CLxxxx, CTxxxx, or CSxxxx format.
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 a 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 returns 'true' if system name has a valid format, else returns 'false'
 
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

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 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'


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 a 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. If the address in the system name is not within the legal maximum range for the type of item (L, T, or S), an empty string is returned. Otherwise a normalized name is returned in the same format as the input name.


makeSystemName

public static String makeSystemName(String type,
                                    int bitNum)
Public static method to construct a system name from type character and bit number

This routine returns a system name in the CLxxxx, CTxxxx, or CSxxxx format. The returned name is normalized.

If the supplied character is not valid, or the bit number is out of the 1 - 9000 range, an error message is logged and the null string "" is returned.


isOutputBitFree

public static String isOutputBitFree(int bitNum)
Public static method to test if a output bit is free for assignment Returns "" (null string) if the specified output bit is free for assignment, else returns the system name of the conflicting assignment. Test is not performed if the node address or bit number are illegal.


isInputBitFree

public static String isInputBitFree(int bitNum)
Public static method to test if a input bit is free for assignment Returns "" (null string) if the specified input bit is free for assignment, else returns the system name of the conflicting assignment. Test is not performed if the node address is illegal or bit number is greater than 2048.


getUserNameFromSystemName

public static String getUserNameFromSystemName(String systemName)
Public static method to the user name for a valid system name Returns "" (null string) if the system name is not valid or does not exist



Copyright © 1997 - 2011 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: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads