faa.tg.nas.communication
Class Frequency

java.lang.Object
  extended by faa.tg.nas.communication.Frequency
All Implemented Interfaces:
DraStorable, HasName, Filterable, ManagedObject, java.io.Serializable, java.lang.Cloneable

public class Frequency
extends java.lang.Object
implements java.lang.Cloneable, DraStorable

 Frequency is a class to help define frequencies as
 used for voice communications.
 
See the source: Frequency.java

Version:
$Id: Frequency.java,v 3.6 2008/10/27 19:43:23 lykensj Exp $
Author:
Michael E. Ross
See Also:
Serialized Form

Field Summary
static java.lang.String CVS_VERSION_ID
          The CVS Version ID.
static java.lang.String ENROUTE
           
private static java.util.Map<java.lang.String,Frequency> existingFreqs
           
private  java.lang.Integer frequency
           
private  java.lang.String frequencyAirspaceType
           
(package private) static long serialVersionUID
           
static java.lang.String TERMINAL
           
static Frequency ZERO
           
 
Constructor Summary
Frequency(java.lang.String frequencyStr)
          Constructor for Frequency: adds constructed Frequency to hash list to allow getInstance() to get a previously created Frequency object.
 
Method Summary
private static java.lang.String addZerosToEnd(java.lang.String frequency)
          This method adds zeros onto the end of a frequency string without a period.
 Frequency clone()
          Override protected method clone() in Object.
 boolean equals(java.lang.Object otherFrequency)
          Determines if the given frequency is equal to this frequency.
 java.lang.String getAirspaceType()
          Get Airspace Type of a frequency.
static Frequency getInstance(java.lang.String frequencyStr)
          Returns the previously constructed Frequency specified by the string, or returns a newly constructed Frequency.
 java.lang.String getName()
          Returns the frequency with a decimal to use as the Frequency name.
 int hashCode()
           
private static java.lang.String insertPeriod(java.lang.String frequency)
          This method inserts a period into the frequency.
 int intValue()
          Returns the frequency as an integer.
static void main(java.lang.String[] args)
          Main method for testing purposes.
private static java.lang.String removePeriod(java.lang.String frequency)
          This method removes a period from the frequency if there is one
 void setAirspaceType(java.lang.String frequencyAirspaceType)
          This method sets the Airspace Type - Enroute or Terminal.
static java.lang.String standardizeFreqStr(java.lang.String frequencyStr)
          Standardizes Frequency string to a six digit, no-decimal format.
 java.lang.String toDetailString()
          Returns the frequency and detail info (if any) as a string.
 java.lang.String toString()
          Returns the frequency as a string.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

CVS_VERSION_ID

public static final java.lang.String CVS_VERSION_ID
The CVS Version ID.

See Also:
Constant Field Values

frequency

private java.lang.Integer frequency

frequencyAirspaceType

private java.lang.String frequencyAirspaceType

TERMINAL

public static final java.lang.String TERMINAL
See Also:
Constant Field Values

ENROUTE

public static final java.lang.String ENROUTE
See Also:
Constant Field Values

existingFreqs

private static java.util.Map<java.lang.String,Frequency> existingFreqs

ZERO

public static final Frequency ZERO
Constructor Detail

Frequency

public Frequency(java.lang.String frequencyStr)
Constructor for Frequency: adds constructed Frequency to hash list to allow getInstance() to get a previously created Frequency object.

Parameters:
frequencyStr - Frequency as a numerical String.
Method Detail

getInstance

public static Frequency getInstance(java.lang.String frequencyStr)
Returns the previously constructed Frequency specified by the string, or returns a newly constructed Frequency.

Parameters:
frequencyStr - Frequency as a String.

clone

public Frequency clone()
Override protected method clone() in Object.

Specified by:
clone in interface DraStorable
Overrides:
clone in class java.lang.Object
Returns:
A Frequency with the same frequency value.

equals

public boolean equals(java.lang.Object otherFrequency)
Determines if the given frequency is equal to this frequency.

Overrides:
equals in class java.lang.Object
Parameters:
otherFrequency - Frequency to compare to this frequency.
Returns:
Returns whether the frequencies are equal.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getName

public java.lang.String getName()
Returns the frequency with a decimal to use as the Frequency name.

Specified by:
getName in interface DraStorable
Specified by:
getName in interface ManagedObject
Returns:
The frequency value as a String in the format "999.999".

intValue

public int intValue()
Returns the frequency as an integer.


standardizeFreqStr

public static java.lang.String standardizeFreqStr(java.lang.String frequencyStr)
Standardizes Frequency string to a six digit, no-decimal format.

Parameters:
frequencyStr - Frequency as a numerical String in standard format.

removePeriod

private static java.lang.String removePeriod(java.lang.String frequency)
This method removes a period from the frequency if there is one

Parameters:
frequency - The Frequency as a string to take the period out of.
Returns:
Returns the frequency string without the period, if one.

insertPeriod

private static java.lang.String insertPeriod(java.lang.String frequency)
This method inserts a period into the frequency.

Parameters:
frequency - The Frequency as a string to period into.
Returns:
Returns the frequency string with the period inserted.

addZerosToEnd

private static java.lang.String addZerosToEnd(java.lang.String frequency)
This method adds zeros onto the end of a frequency string without a period. WARNING: This method assumes that the frequency is six digits long.

Parameters:
frequency - The Frequency as a string to add zeros to the end of.
Returns:
Returns the frequency as a six-digit string.

setAirspaceType

public void setAirspaceType(java.lang.String frequencyAirspaceType)
This method sets the Airspace Type - Enroute or Terminal.

Parameters:
frequencyAirspaceType - Type of airspace.

getAirspaceType

public java.lang.String getAirspaceType()
Get Airspace Type of a frequency.

Returns:
Returns the Airspace Type of a frequency.

toDetailString

public java.lang.String toDetailString()
Returns the frequency and detail info (if any) as a string.


toString

public java.lang.String toString()
Returns the frequency as a string.

Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)
Main method for testing purposes.