uavsim.datatypes
Class FrequencyComponent

java.lang.Object
  extended by uavsim.datatypes.FrequencyComponent
All Implemented Interfaces:
java.lang.Comparable<FrequencyComponent>, I_Unitable<FrequencyComponent>

public class FrequencyComponent
extends java.lang.Object
implements I_Unitable<FrequencyComponent>

Defines a component of frequency in terms of a value on interval. A component is the numerical value to the left or right of the decimal place in a frequency.

Author:
Dan Tappan [14.07.11]

Field Summary
private  int _max
          the maximum value
private  int _min
          the minimum value
private  int _step
          the step up or down
private  int _value
          the value
 
Constructor Summary
FrequencyComponent(int value, int min, int max, int step)
          Creates a frequency component.
 
Method Summary
 FrequencyComponent add_(FrequencyComponent value)
          Adds another unit to this one.
 int compareTo(FrequencyComponent component)
          
 java.lang.String formatString(int width)
          Formats the component padded with zeros.
 double getMax()
          Gets the maximum value.
 double getMin()
          Gets the minimum value.
 double getStep()
          Gets the step value.
 double getValue_()
          Returns the numerical value of this unit.
 FrequencyComponent subtract_(FrequencyComponent value)
          Subtract another unit from this one.
 java.lang.String toString()
          
private  int wrap(int value)
          Wraps the value back onto the interval if it is off it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_max

private final int _max
the maximum value


_min

private final int _min
the minimum value


_step

private final int _step
the step up or down


_value

private final int _value
the value

Constructor Detail

FrequencyComponent

public FrequencyComponent(int value,
                          int min,
                          int max,
                          int step)
Creates a frequency component. Values off the interval wrap back on.

Parameters:
value - - the value
min - - the minimum value
max - - the maximum value
step - - the step up or down
Method Detail

add_

public FrequencyComponent add_(FrequencyComponent value)
Adds another unit to this one.

Specified by:
add_ in interface I_Unitable<FrequencyComponent>
Parameters:
value - - the unit
Returns:
the result as a new unit

compareTo

public int compareTo(FrequencyComponent component)

Specified by:
compareTo in interface java.lang.Comparable<FrequencyComponent>

formatString

public java.lang.String formatString(int width)
Formats the component padded with zeros.

Parameters:
width - - the number of decimal places
Returns:
the string

getMax

public double getMax()
Gets the maximum value.

Returns:
the value

getMin

public double getMin()
Gets the minimum value.

Returns:
the value

getStep

public double getStep()
Gets the step value.

Returns:
the value

getValue_

public double getValue_()
Returns the numerical value of this unit.

Specified by:
getValue_ in interface I_Unitable<FrequencyComponent>
Returns:
the value

subtract_

public FrequencyComponent subtract_(FrequencyComponent value)
Subtract another unit from this one.

Specified by:
subtract_ in interface I_Unitable<FrequencyComponent>
Parameters:
value - - the unit
Returns:
the result as a new unit

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

wrap

private int wrap(int value)
Wraps the value back onto the interval if it is off it.

Parameters:
value - - the value
Returns:
the wrapped value