Package gnu.math
Class Unit
java.lang.Object
java.lang.Number
gnu.math.Numeric
gnu.math.Quantity
gnu.math.Unit
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
NamedUnit
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Unitstatic final NamedUnitstatic final Unitstatic final BaseUnitstatic BaseUnitstatic final Unitstatic final BaseUnitstatic final Unitstatic final Unitstatic final BaseUnitstatic final Unitstatic final Unitstatic final NamedUnitstatic doubleA magic factor to indicate units that have the same "dimension" but not a fixed multiple.static final Unitstatic final Unitstatic final Unitstatic final NamedUnit -
Method Summary
Modifier and TypeMethodDescriptionstatic Unitstatic Unitfinal Dimensionsstatic Unitfinal doubleThe value of the real component, as a double.getName()inthashCode()booleanisExact()final booleanisZero()static NamedUnitstatic NamedUnitnumber()static UnitReturn this raised to an integer power.sqrt()static UnittoString()toString(double val) unit()Methods inherited from class gnu.math.Quantity
abs, add, add, addReversed, compare, compare, compareReversed, div, divide, divReversed, doubleImagValue, doubleJmagValue, doubleKmagValue, im, imValue, jm, jmValue, km, kmValue, make, make, make, mul, mulReversed, neg, re, reValue, times, toStringMethods inherited from class gnu.math.Numeric
add, asNumericOrNull, div_inv, equals, floatValue, geq, grt, intValue, longValue, mul_ident, sub, toExact, toInexactMethods inherited from class java.lang.Number
byteValue, shortValue
-
Field Details
-
Empty
-
NON_COMBINABLE
public static double NON_COMBINABLEA magic factor to indicate units that have the same "dimension" but not a fixed multiple. E.g. "month" and "day", or money of different currencies. Since they have the same dimension, they can be added to get an (unimplemented) combined quantity, but they cannot be compared. No general support yet, but used for time Duration. -
meter
-
duration
-
gram
-
cm
-
mm
-
in
-
pt
-
pica
-
radian
-
degree
-
gradian
-
date
-
second
-
month
-
minute
-
hour
-
-
Method Details
-
dimensions
- Overrides:
dimensionsin classQuantity
-
doubleValue
public final double doubleValue()Description copied from class:QuantityThe value of the real component, as a double. This is relative to the unit().dims - i.e. unit()/doubleValue() is factored in.- Overrides:
doubleValuein classQuantity
-
hashCode
public int hashCode() -
getName
-
times
-
divide
-
pow
-
make
-
define
-
define
-
number
-
isExact
public boolean isExact() -
isZero
public final boolean isZero() -
power
Description copied from class:NumericReturn this raised to an integer power. Implemented by repeated squaring and multiplication. Ify < 0, returns div_inv of the result. -
sqrt
-
lookup
-
toString
-
toString
-
toString
-
unit
-