gnu.math
Class Quantity
java.lang.Object
|
+--java.lang.Number
|
+--gnu.math.Numeric
|
+--gnu.math.Quantity
- Direct Known 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).
- See Also:
- Serialized Form
|
Method Summary |
Numeric |
abs()
|
Numeric |
add(java.lang.Object y,
int k)
|
static Quantity |
add(Quantity x,
Quantity y,
int k)
|
Numeric |
addReversed(Numeric x,
int k)
|
int |
compare(java.lang.Object obj)
|
static int |
compare(Quantity x,
Quantity y)
|
int |
compareReversed(Numeric x)
|
Dimensions |
dimensions()
|
Numeric |
div(java.lang.Object y)
|
static Quantity |
div(Quantity x,
Quantity y)
|
Numeric |
divReversed(Numeric x)
|
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 real component, as a double. |
static Quantity |
make(Complex x,
Unit u)
|
static Quantity |
make(double re,
double im,
Unit unit)
|
static Quantity |
make(RealNum re,
RealNum im,
Unit unit)
|
Numeric |
mul(java.lang.Object y)
|
static Quantity |
mul(Quantity x,
Quantity 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 imaginary component, as a double. |
java.lang.String |
toString(int radix)
|
Unit |
unit()
|
| Methods inherited from class gnu.math.Numeric |
add,
div_inv,
equals,
floatValue,
geq,
grt,
intValue,
isExact,
isZero,
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 |
Quantity
public Quantity()
unit
public Unit unit()
dimensions
public Dimensions dimensions()
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.
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.
reValue
public final double reValue()
- 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 doubleValue.
imValue
public final double imValue()
- 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 doubleImagValue.
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.
- Overrides:
- doubleValue in class java.lang.Number
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.
make
public static Quantity make(Complex x,
Unit u)
make
public static Quantity make(RealNum re,
RealNum im,
Unit unit)
make
public static Quantity make(double re,
double im,
Unit unit)
neg
public Numeric neg()
- Overrides:
- neg in class Numeric
abs
public Numeric abs()
- Overrides:
- abs in class Numeric
compare
public static int compare(Quantity x,
Quantity y)
compare
public int compare(java.lang.Object obj)
- Overrides:
- compare in class Numeric
compareReversed
public int compareReversed(Numeric x)
- Overrides:
- compareReversed in class Numeric
add
public static Quantity add(Quantity x,
Quantity y,
int k)
add
public Numeric add(java.lang.Object y,
int k)
- Overrides:
- add in class Numeric
addReversed
public Numeric addReversed(Numeric x,
int k)
- Overrides:
- addReversed in class Numeric
mul
public static Quantity mul(Quantity x,
Quantity y)
mul
public Numeric mul(java.lang.Object y)
- Overrides:
- mul in class Numeric
mulReversed
public Numeric mulReversed(Numeric x)
- Overrides:
- mulReversed in class Numeric
div
public static Quantity div(Quantity x,
Quantity y)
div
public Numeric div(java.lang.Object y)
- Overrides:
- div in class Numeric
divReversed
public Numeric divReversed(Numeric x)
- Overrides:
- divReversed in class Numeric
toString
public java.lang.String toString(int radix)
- Overrides:
- toString in class Numeric