driver.ted.utilities
Class T_Converter

java.lang.Object
  extended by driver.ted.utilities.T_Converter

public class T_Converter
extends java.lang.Object

Title: T_Converter class Description: This class converts numbers from several formats into several formats Copyright: (c) 2002 - 2006

Version:
1.1 Changes:
Author:
Ted Driver

Field Summary
static int BINARY
          The designator for BINARY inputs and outputs.
static int HEX
          The designator for HEX inputs and outputs.
static int INTEGER
          The designator for INTEGER inputs and outputs.
static int OCTAL
          The designator for OCTAL inputs and outputs.
 
Constructor Summary
T_Converter()
          Default constructor does nothing.
 
Method Summary
static java.lang.String getBinary(java.lang.String value, int inputType, int pad)
          This function will accept a string and return a binary representation of the value supplied once converted to inputType.
static java.lang.String getHex(java.lang.String value, int inputType)
          This function will accept a string and return a Hex representation of the value supplied once converted to inputType.
static java.lang.String getInt(java.lang.String value, int inputType)
          This function will accept a string and return an Integer representation of the value supplied once converted to inputType.
static java.lang.String getOctal(java.lang.String value, int inputType)
          This function will accept a string and return an octal representation of the value supplied once converted to inputType.
static void main(java.lang.String[] args)
          A program to provide the testing for the T_Converter class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BINARY

public static final int BINARY
The designator for BINARY inputs and outputs. The BINARY field designator is assigned a value of 2 and can be used to specify the radix if desired.

See Also:
Constant Field Values

OCTAL

public static final int OCTAL
The designator for OCTAL inputs and outputs. The OCTAL field designator is assigned a value of 8 and can be used to specify the radix if desired.

See Also:
Constant Field Values

INTEGER

public static final int INTEGER
The designator for INTEGER inputs and outputs. The INTEGER field designator is assigned a value of 10 and can be used to specify the radix if desired.

See Also:
Constant Field Values

HEX

public static final int HEX
The designator for HEX inputs and outputs. The HEX field designator is assigned a value of 16 and can be used to specify the radix if desired.

See Also:
Constant Field Values
Constructor Detail

T_Converter

public T_Converter()
Default constructor does nothing.

Method Detail

getBinary

public static java.lang.String getBinary(java.lang.String value,
                                         int inputType,
                                         int pad)
This function will accept a string and return a binary representation of the value supplied once converted to inputType. If the pad variable is set, the binary representation will be prepadded to the next multiple of 4 and a space will be added between every 4th digit.

Parameters:
value - The value to convert to binary
inputType - One of the available fields in the class, specifying the input type
pad - An integer specifying how many digits to space in between numbers. Use a value of zero (0) if no padding is required. pad will typically be 4 for hex representations, 3 for octal representations. A pad of 29 will designate that the binary string will be padded for the 29 bit GPS Z-Count, placing a space between the 19th and 20th LSBs to represent the Week and Time of Week.
Returns:
A String containing the (possibly padded) binary representation of the input value

getHex

public static java.lang.String getHex(java.lang.String value,
                                      int inputType)
This function will accept a string and return a Hex representation of the value supplied once converted to inputType.

Parameters:
value - The value to convert to Hex
inputType - One of the available fields in the class, specifying the input type
Returns:
A String containing the Hex representation of the input value

getInt

public static java.lang.String getInt(java.lang.String value,
                                      int inputType)
This function will accept a string and return an Integer representation of the value supplied once converted to inputType.

Parameters:
value - The value to convert to an integer
inputType - One of the available fields in the class, specifying the input type
Returns:
A String containing the integer representation of the input value

getOctal

public static java.lang.String getOctal(java.lang.String value,
                                        int inputType)
This function will accept a string and return an octal representation of the value supplied once converted to inputType.

Parameters:
value - The value to convert to octal
inputType - One of the available fields in the class, specifying the input type
Returns:
A String containing the octal representation of the input value

main

public static void main(java.lang.String[] args)
A program to provide the testing for the T_Converter class

Parameters:
args - Array of strings to use in the main app