Package gnu.math
Class DQuantity
- java.lang.Object
-
- java.lang.Number
-
- gnu.math.Numeric
-
- gnu.math.Quantity
-
- gnu.math.DQuantity
-
- All Implemented Interfaces:
Externalizable
,Serializable
public class DQuantity extends Quantity implements Externalizable
A Quantity represented as the product of a plain double and a Unit.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DQuantity
add(DQuantity x, DQuantity y, double k)
Numeric
add(Object y, int k)
Return this + k * obj.Numeric
addReversed(Numeric x, int k)
Calculatex+k&this
.Numeric
div(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(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, compare, compare, compareReversed, dimensions, divide, doubleImagValue, doubleJmagValue, doubleKmagValue, im, imValue, jm, jmValue, km, kmValue, make, make, make, neg, reValue, times, toString
-
Methods inherited from class gnu.math.Numeric
add, asNumericOrNull, div_inv, equals, floatValue, geq, grt, intValue, longValue, mul_ident, power, sub, toExact, toInexact, toString
-
Methods inherited from class java.lang.Number
byteValue, shortValue
-
-
-
-
Constructor Detail
-
DQuantity
public DQuantity(double factor, Unit unit)
-
-
Method Detail
-
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.
-
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 classQuantity
-
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 classQuantity
-
mulReversed
public Numeric mulReversed(Numeric x)
- Overrides:
mulReversed
in classQuantity
-
divReversed
public Numeric divReversed(Numeric x)
- Overrides:
divReversed
in classQuantity
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
-