gnu.math
Class DQuantity

java.lang.Object
  extended by java.lang.Number
      extended by gnu.math.Numeric
          extended by gnu.math.Quantity
              extended by gnu.math.DQuantity
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class DQuantity
extends Quantity
implements java.io.Externalizable

A Quantity represented as the product of a plain double and a Unit.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class gnu.math.Numeric
CEILING, FLOOR, ROUND, TRUNCATE
 
Constructor Summary
DQuantity(double factor, Unit unit)
           
 
Method Summary
static DQuantity add(DQuantity x, DQuantity y, double k)
           
 Numeric add(java.lang.Object y, int k)
          Return this + k * obj.
 Numeric addReversed(Numeric x, int k)
          Calculate x+k&this.
 Numeric div(java.lang.Object y)
           
static DQuantity divide(DQuantity x, DQuantity y)
           
 Numeric divReversed(Numeric x)
           
 double doubleValue()
          The value of the real component, as a double.
 boolean isExact()
           
 boolean isZero()
           
 Numeric mul(java.lang.Object y)
           
 Numeric mulReversed(Numeric x)
           
 Complex number()
           
 RealNum re()
          The value of the real component, as a RealNum.
 void readExternal(java.io.ObjectInput in)
           
static DQuantity times(DQuantity x, DQuantity y)
           
 Unit unit()
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class gnu.math.Quantity
abs, add, compare, compare, compareReversed, dimensions, divide, doubleImagValue, im, imValue, make, make, make, neg, reValue, times, toString
 
Methods inherited from class gnu.math.Numeric
add, div_inv, equals, floatValue, geq, grt, intValue, longValue, mul_ident, power, sub, toString
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DQuantity

public DQuantity(double factor,
                 Unit unit)
Method Detail

unit

public final Unit unit()
Overrides:
unit in class Quantity

number

public final Complex number()
Specified by:
number in class Quantity

re

public final RealNum re()
Description copied from class: Quantity
The value of the real component, as a RealNum. The unit() is not factored in, so you actually need to multiply by unit() to get the true real component.

Overrides:
re in class Quantity

doubleValue

public final double doubleValue()
Description copied from class: Quantity
The value of the real component, as a double. This is relative to the unit().dims - i.e. unit()/doubleValue() is factored in.

Overrides:
doubleValue in class Quantity

isExact

public boolean isExact()
Specified by:
isExact in class Numeric

isZero

public boolean isZero()
Specified by:
isZero in class Numeric

add

public static DQuantity add(DQuantity x,
                            DQuantity y,
                            double k)

times

public static DQuantity times(DQuantity x,
                              DQuantity y)

divide

public static DQuantity divide(DQuantity x,
                               DQuantity y)

add

public Numeric add(java.lang.Object y,
                   int k)
Description copied from class: Numeric
Return this + k * obj.

Overrides:
add in class Quantity

addReversed

public Numeric addReversed(Numeric x,
                           int k)
Description copied from class: Numeric
Calculate x+k&this.

Overrides:
addReversed in class Quantity

mul

public Numeric mul(java.lang.Object y)
Overrides:
mul in class Quantity

mulReversed

public Numeric mulReversed(Numeric x)
Overrides:
mulReversed in class Quantity

div

public Numeric div(java.lang.Object y)
Overrides:
div in class Quantity

divReversed

public Numeric divReversed(Numeric x)
Overrides:
divReversed in class Quantity

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException