gnu.math

Class Quantity

Known Direct Subclasses:
Complex, CQuantity, DQuantity, Unit

public abstract class Quantity
extends Numeric

A quantity with a unit. This generalizes the DSSSL quantity type (to more than lengths).

Field Summary

Fields inherited from class gnu.math.Numeric

CEILING, FLOOR, ROUND, TRUNCATE

Method Summary

Numeric
abs()
Numeric
add(Object y, int k)
Return this + k * obj.
static Quantity
add(Quantity x, Quantity y, int k)
Numeric
addReversed(Numeric x, int k)
Calculate x+k&this.
int
compare(Object obj)
Return 1 if this>obj; 0 if this==obj; -1 if this
static int
compare(Quantity x, Quantity y)
int
compareReversed(Numeric x)
Dimensions
dimensions()
Numeric
div(Object y)
Numeric
divReversed(Numeric x)
static Quantity
divide(Quantity x, Quantity y)
double
doubleImagValue()
The value of the imaginary component, as a double.
double
doubleValue()
The value of the real component, as a double.
RealNum
im()
The value of the imaginary component, as a RealNum.
double
imValue()
The value of the imaginary component, as a double.
static Quantity
make(double re, double im, Unit unit)
static Quantity
make(Complex x, Unit u)
static Quantity
make(RealNum re, RealNum im, Unit unit)
Numeric
mul(Object y)
Numeric
mulReversed(Numeric x)
Numeric
neg()
abstract Complex
number()
RealNum
re()
The value of the real component, as a RealNum.
double
reValue()
The value of the real component, as a double.
static Quantity
times(Quantity x, Quantity y)
String
toString(int radix)
Unit
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

Method Details

abs

public Numeric abs()
Overrides:
abs in interface Numeric

add

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

add

public static Quantity add(Quantity x,
                           Quantity y,
                           int k)

addReversed

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

compare

public int compare(Object obj)
Return 1 if this>obj; 0 if this==obj; -1 if this
Overrides:
compare in interface Numeric

compare

public static int compare(Quantity x,
                          Quantity y)

compareReversed

public int compareReversed(Numeric x)
Overrides:
compareReversed in interface Numeric

dimensions

public Dimensions dimensions()

div

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

divReversed

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

divide

public static Quantity divide(Quantity x,
                              Quantity y)

doubleImagValue

public double doubleImagValue()
The value of the imaginary component, as a double. This is relative to the unit().dims - i.e. unit()/doubleValue() is factored in.

doubleValue

public 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.

im

public RealNum im()
The value of the imaginary component, as a RealNum. The unit() is not factored in, so you actually need to multiply by unit() to get the true imaginary component.

imValue

public final double imValue()
The value of the imaginary component, as a double. This is relative to the unit().dims - i.e. unit().doubleValue() is factored in. A final alias for the virtual doubleImagValue.

make

public static Quantity make(double re,
                            double im,
                            Unit unit)

make

public static Quantity make(Complex x,
                            Unit u)

make

public static Quantity make(RealNum re,
                            RealNum im,
                            Unit unit)

mul

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

mulReversed

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

neg

public Numeric neg()
Overrides:
neg in interface Numeric

number

public abstract Complex number()

re

public 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.

reValue

public final double reValue()
The value of the real component, as a double. This is relative to the unit().dims - i.e. unit().doubleValue() is factored in. A final alias for the virtual doubleValue.

times

public static Quantity times(Quantity x,
                             Quantity y)

toString

public String toString(int radix)
Overrides:
toString in interface Numeric

unit

public Unit unit()