uavsim.datatypes
Class Scaler

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

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

Defines a scaler, which is a non-negative scaling coefficient representing a percentage. For example, a scaler of 0.5 applied to a box would decrease its width and height by half.

Author:
Dan Tappan [26.06.11]

Field Summary
private  double _value
          the non-negative scale
static Scaler HALF
           
static Scaler QUARTER
          zzz
static Scaler THREE_QUARTER
           
 
Constructor Summary
Scaler(double value)
          Creates a scaler.
 
Method Summary
 Scaler add_(Scaler value)
          Adds another unit to this one.
 int compareTo(Scaler value)
          
 double getValue_()
          Returns the numerical value of this unit.
 double remapToNegativePositive()
          Remaps a scaler on the interval [0,1] to [-1.+1].
 Scaler rescale(Scaler scaler)
          Rescales this scaler according to another one.
private  void setScaler(double value)
          Sets the scale.
 Scaler subtract_(Scaler value)
          Subtract another unit from this one.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_value

private double _value
the non-negative scale


HALF

public static final Scaler HALF

QUARTER

public static final Scaler QUARTER
zzz


THREE_QUARTER

public static final Scaler THREE_QUARTER
Constructor Detail

Scaler

public Scaler(double value)
Creates a scaler.

Parameters:
value - - the non-negative scale
Method Detail

add_

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

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

compareTo

public int compareTo(Scaler value)

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

getValue_

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

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

remapToNegativePositive

public double remapToNegativePositive()
Remaps a scaler on the interval [0,1] to [-1.+1].

Returns:
the remapped scaler

rescale

public Scaler rescale(Scaler scaler)
Rescales this scaler according to another one. This basically functions as a multiply method.

Parameters:
scaler - - the other scaler
Returns:
the result

setScaler

private void setScaler(double value)
Sets the scale.

Parameters:
value - - the non-negative scale

subtract_

public Scaler subtract_(Scaler value)
Subtract another unit from this one. A negative result is illegal.

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

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object