gnu.math

Class DQuantity

Implemented Interfaces:
Externalizable

public class DQuantity
extends Quantity
implements Externalizable

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

Field Summary

Fields inherited from class gnu.math.Numeric

CEILING, FLOOR, ROUND, TRUNCATE

Constructor Summary

DQuantity(double factor, Unit unit)

Method Summary

Numeric
add(Object y, int k)
Return this + k * obj.
static DQuantity
add(DQuantity x, DQuantity y, double k)
Numeric
addReversed(Numeric x, int k)
Calculate x+k&this.
Numeric
div(Object y)
Numeric
divReversed(Numeric x)
static DQuantity
divide(DQuantity x, DQuantity y)
double
doubleValue()
The value of the real component, as a double.
boolean
isExact()
boolean
isZero()
Numeric
mul(Object y)
Numeric
mulReversed(Numeric x)
Complex
number()
RealNum
re()
The value of the real component, as a RealNum.
void
readExternal(ObjectInput in)
static DQuantity
times(DQuantity x, DQuantity y)
Unit
unit()
void
writeExternal(ObjectOutput out)

Methods inherited from class gnu.math.Quantity

abs, add, add, addReversed, compare, compare, compareReversed, dimensions, div, divReversed, divide, doubleImagValue, doubleValue, im, imValue, make, make, make, mul, mulReversed, neg, number, re, reValue, times, toString, unit

Methods inherited from class gnu.math.Numeric

abs, add, add, addReversed, compare, compareReversed, div, divReversed, div_inv, equals, floatValue, geq, grt, intValue, isExact, isZero, longValue, mul, mulReversed, mul_ident, neg, power, sub, toString, toString

Constructor Details

DQuantity

public DQuantity(double factor,
                 Unit unit)

Method Details

add

public Numeric add(Object y,
                   int k)
Return this + k * obj.
Overrides:
add in interface Quantity

add

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

addReversed

public Numeric addReversed(Numeric x,
                           int k)
Calculate x+k&this.
Overrides:
addReversed in interface Quantity

div

public Numeric div(Object y)
Overrides:
div in interface Quantity

divReversed

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

divide

public static DQuantity divide(DQuantity x,
                               DQuantity y)

doubleValue

public final double doubleValue()
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 interface Quantity

isExact

public boolean isExact()
Overrides:
isExact in interface Numeric

isZero

public boolean isZero()
Overrides:
isZero in interface Numeric

mul

public Numeric mul(Object y)
Overrides:
mul in interface Quantity

mulReversed

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

number

public final Complex number()
Overrides:
number in interface Quantity

re

public final RealNum re()
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 interface Quantity

readExternal

public void readExternal(ObjectInput in)
            throws IOException,
                   ClassNotFoundException

times

public static DQuantity times(DQuantity x,
                              DQuantity y)

unit

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

writeExternal

public void writeExternal(ObjectOutput out)
            throws IOException