airport
Class AirportInfoRecord

java.lang.Object
  |
  +--airport.AirportInfoRecord

public class AirportInfoRecord
extends java.lang.Object

This class defines a structure to hold information about the location and format (type) of a piece of information in the Airport memory block. Location is specified by a triple: the object identifier number (1 to 68), row in the block (0 to 15), and column (0 to 15), where the ByteBlockWindow begins; size of the window is specified by giving the number of rows and columns in the window; and the datatype is specified as one of the class's constants. The class also implements a toString() method which provides a pretty-printed representation of the value in the window based on its datatype, and a setBytesFromString() method which writes a value to the window given an appropriately formatted String representation.


Field Summary
static int BYTE
           
static int BYTE_STRING
           
 ByteBlockWindow byteBlockWindow
           
static int CHAR_STRING
           
 int dataType
           
static int IP_ADDRESS
           
static int LITTLE_ENDIAN_UNSIGNED_INTEGER
           
static int PHONE_NUMBER
           
static int UNSIGNED_INTEGER
           
 
Constructor Summary
AirportInfoRecord(int dataType, ByteBlockWindow window)
          Create a new record of given datatype for the specified ByteBlockWindow.
AirportInfoRecord(int baseStartIndex, int numRows, int numCols, int dataType, ByteBlock baseBlock)
          Create a new record with the specified parameters, creating a new ByteBlockRectangularWindow into the supplied ByteBlock.
 
Method Summary
 void clearWindow()
          Clear all bytes in the underlying ByteBlockWindow.
static char decodePhoneDigit(byte digit)
          Utility method that does single-digit mapping from nibble (half-byte, 4-bit) values to appropriate char values.
static byte encodePhoneDigit(char digit)
          Utility method that does single-digit mapping from char values to appropriate nibble (half-byte, 4-bit) values.
 void setBytesFromString(java.lang.String valueString)
          Writes a value to the window given an appropriately formatted String representation for the value.
 java.lang.String toString()
          Method which provides a pretty-printed representation of the value in the ByteBlockWindow based on its datatype.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CHAR_STRING

public static final int CHAR_STRING

IP_ADDRESS

public static final int IP_ADDRESS

BYTE_STRING

public static final int BYTE_STRING

PHONE_NUMBER

public static final int PHONE_NUMBER

UNSIGNED_INTEGER

public static final int UNSIGNED_INTEGER

BYTE

public static final int BYTE

LITTLE_ENDIAN_UNSIGNED_INTEGER

public static final int LITTLE_ENDIAN_UNSIGNED_INTEGER

dataType

public int dataType

byteBlockWindow

public ByteBlockWindow byteBlockWindow
Constructor Detail

AirportInfoRecord

public AirportInfoRecord(int baseStartIndex,
                         int numRows,
                         int numCols,
                         int dataType,
                         ByteBlock baseBlock)
Create a new record with the specified parameters, creating a new ByteBlockRectangularWindow into the supplied ByteBlock.

AirportInfoRecord

public AirportInfoRecord(int dataType,
                         ByteBlockWindow window)
Create a new record of given datatype for the specified ByteBlockWindow.
Method Detail

clearWindow

public void clearWindow()
Clear all bytes in the underlying ByteBlockWindow.

toString

public java.lang.String toString()
Method which provides a pretty-printed representation of the value in the ByteBlockWindow based on its datatype.
Overrides:
toString in class java.lang.Object

decodePhoneDigit

public static char decodePhoneDigit(byte digit)
Utility method that does single-digit mapping from nibble (half-byte, 4-bit) values to appropriate char values. This is used in displaying phone numbers. The mapping is: 0xA == '*' 0xB == '#' 0xC == ',' 0xD == ' ' (note: also used for both (!) left and right parens... 0xE == '-' 0xF == '.'

setBytesFromString

public void setBytesFromString(java.lang.String valueString)
                        throws ValueFormatException
Writes a value to the window given an appropriately formatted String representation for the value.

encodePhoneDigit

public static byte encodePhoneDigit(char digit)
                             throws java.lang.NumberFormatException
Utility method that does single-digit mapping from char values to appropriate nibble (half-byte, 4-bit) values. This is used in encoding phone numbers. The mapping is: 0xA == '*' 0xB == '#' 0xC == ',' 0xD == ' ' (note: also used for both (!) left and right parens... 0xE == '-' 0xF == '.'