Package gnu.math
Class Quantity
- java.lang.Object
-
- java.lang.Number
-
- gnu.math.Numeric
-
- gnu.math.Quantity
-
- All Implemented Interfaces:
Serializable
public abstract class Quantity extends Numeric
A quantity with a unit. This generalizes the DSSSL quantity type (to more than lengths).- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Quantity()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Numeric
abs()
static Quantity
add(Quantity x, Quantity y, int k)
Numeric
add(Object y, int k)
Return this + k * obj.Numeric
addReversed(Numeric x, int k)
Calculatex+k&this
.static int
compare(Quantity x, Quantity y)
int
compare(Object obj)
Return an integer for which ofthis
orobj
is larger.int
compareReversed(Numeric x)
Dimensions
dimensions()
Numeric
div(Object y)
static Quantity
divide(Quantity x, Quantity y)
Numeric
divReversed(Numeric x)
double
doubleImagValue()
The value of the imaginary component, as a double.double
doubleJmagValue()
The value of the "j" component, as a double.double
doubleKmagValue()
The value of the "k" 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.RealNum
jm()
The value of the "j" component, as a RealNum.double
jmValue()
The value of the "j" component, as a double.RealNum
km()
The value of the "k" component, as a RealNum.double
kmValue()
The value of the "k" component, as a double.static Quantity
make(double re, double im, double jm, double km, Unit unit)
static Quantity
make(Quaternion x, Unit u)
static Quantity
make(RealNum re, RealNum im, RealNum jm, RealNum km, Unit unit)
Numeric
mul(Object y)
Numeric
mulReversed(Numeric x)
Numeric
neg()
abstract Quaternion
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
add, asNumericOrNull, div_inv, equals, floatValue, geq, grt, intValue, isExact, isZero, longValue, mul_ident, power, sub, toExact, toInexact, toString
-
Methods inherited from class java.lang.Number
byteValue, shortValue
-
-
-
-
Method Detail
-
unit
public Unit unit()
-
dimensions
public Dimensions dimensions()
-
number
public abstract Quaternion 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.
-
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.
-
jm
public RealNum jm()
The value of the "j" component, as a RealNum. The unit() is not factored in, so you actually need to multiply by unit() to get the true "j" component.
-
km
public RealNum km()
The value of the "k" component, as a RealNum. The unit() is not factored in, so you actually need to multiply by unit() to get the true "k" 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.
-
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.
-
jmValue
public final double jmValue()
The value of the "j" component, as a double. This is relative to the unit().dims - i.e. unit().doubleValue() is factored in. A final alias for the virtual doubleJmagValue.
-
kmValue
public final double kmValue()
The value of the "k" component, as a double. This is relative to the unit().dims - i.e. unit().doubleValue() is factored in. A final alias for the virtual doubleKmagValue.
-
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.- Specified by:
doubleValue
in classNumber
-
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.
-
doubleJmagValue
public double doubleJmagValue()
The value of the "j" component, as a double. This is relative to the unit().dims - i.e. unit()/doubleValue() is factored in.
-
doubleKmagValue
public double doubleKmagValue()
The value of the "k" component, as a double. This is relative to the unit().dims - i.e. unit()/doubleValue() is factored in.
-
make
public static Quantity make(Quaternion x, Unit u)
-
compare
public int compare(Object obj)
Description copied from class:Numeric
Return an integer for which ofthis
orobj
is larger. Return 1 ifthis>obj
; 0 ifthis==obj
; -1 ifthis<obj
; -2 ifthis!=obj
otherwise (for example if either is NaN); -3 if not comparable (incompatible types).
-
compareReversed
public int compareReversed(Numeric x)
- Overrides:
compareReversed
in classNumeric
-
add
public Numeric add(Object y, int k)
Description copied from class:Numeric
Return this + k * obj.
-
addReversed
public Numeric addReversed(Numeric x, int k)
Description copied from class:Numeric
Calculatex+k&this
.- Overrides:
addReversed
in classNumeric
-
mulReversed
public Numeric mulReversed(Numeric x)
- Overrides:
mulReversed
in classNumeric
-
divReversed
public Numeric divReversed(Numeric x)
- Overrides:
divReversed
in classNumeric
-
-