uavsim.datatypes
Class A_Frequency<_TYPE_ extends A_Frequency<?>>

java.lang.Object
  extended by uavsim.datatypes.A_Frequency<_TYPE_>
Type Parameters:
_TYPE_ - - the frequency type: VOR/DME and NDB
All Implemented Interfaces:
java.lang.Comparable<_TYPE_>, I_Unitable<_TYPE_>
Direct Known Subclasses:
NDBFrequency, VOR_ILS_DME_Frequency

public abstract class A_Frequency<_TYPE_ extends A_Frequency<?>>
extends java.lang.Object
implements I_Unitable<_TYPE_>

Defines the shared aspects of a radio frequency.

Author:
Dan Tappan [14.07.11]

Field Summary
protected  FrequencyComponent _frequencyMajor
          the major component of the frequency (left of the decimal place).
protected  FrequencyComponent _frequencyMinor
          the minor component of the frequency (right of the decimal place).
 
Constructor Summary
A_Frequency(FrequencyComponent frequencyMajor, FrequencyComponent frequencyMinor)
          Creates an abstract frequency object.
 
Method Summary
 int compareTo(_TYPE_ frequency)
           // xxx need to implement equals everywhere!
 java.lang.String formatString(int widthMajor, int widthMinor)
          Generates a string formatted to the major and minor ranges
 FrequencyComponent getFrequencyMajor()
          Gets the major component of the frequency (left of the decimal place).
 FrequencyComponent getFrequencyMinor()
          Gets the minor component of the frequency (right of the decimal place).
 double getValue_()
          Returns the numerical value of this unit.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface uavsim.datatypes.I_Unitable
add_, subtract_
 

Field Detail

_frequencyMajor

protected FrequencyComponent _frequencyMajor
the major component of the frequency (left of the decimal place). This cannot be final because of cloning


_frequencyMinor

protected FrequencyComponent _frequencyMinor
the minor component of the frequency (right of the decimal place). This cannot be final because of cloning

Constructor Detail

A_Frequency

public A_Frequency(FrequencyComponent frequencyMajor,
                   FrequencyComponent frequencyMinor)
Creates an abstract frequency object.

Parameters:
frequencyMajor - - the major component of the frequency (left of the decimal place)
frequencyMinor - - the minor component of the frequency (right of the decimal place)
Method Detail

compareTo

public int compareTo(_TYPE_ frequency)
// xxx need to implement equals everywhere!

Specified by:
compareTo in interface java.lang.Comparable<_TYPE_ extends A_Frequency<?>>

formatString

public java.lang.String formatString(int widthMajor,
                                     int widthMinor)
Generates a string formatted to the major and minor ranges

Parameters:
widthMajor - - the number of digits in the major frequency
widthMinor - - the number of digits in the minor frequency
Returns:
the string

getFrequencyMajor

public FrequencyComponent getFrequencyMajor()
Gets the major component of the frequency (left of the decimal place).

Returns:
the component

getFrequencyMinor

public FrequencyComponent getFrequencyMinor()
Gets the minor component of the frequency (right of the decimal place).

Returns:
the component

getValue_

public double getValue_()
Returns the numerical value of this unit. The result is limited to three decimal places. Rounding errors may occur.

Specified by:
getValue_ in interface I_Unitable<_TYPE_ extends A_Frequency<?>>
Returns:
the value

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object