Package gnu.math
Class Duration
java.lang.Object
java.lang.Number
gnu.math.Numeric
gnu.math.Quantity
gnu.math.Duration
- All Implemented Interfaces:
Externalizable
,Serializable
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Duration
Return this + k * obj.static int
int
Return an integer for which ofthis
orobj
is larger.static double
static boolean
Compare for equality.boolean
Compare for equality.int
getDays()
int
getHours()
int
int
long
int
int
long
int
long
int
getYears()
The number of years in the canonical representation.int
hashCode()
boolean
isExact()
boolean
isZero()
static Duration
static Duration
makeMinutes
(int minutes) static Duration
makeMonths
(int months) number()
static Duration
static Duration
static Duration
parseDuration
(String str) static Duration
void
static Duration
toString()
unit()
static Duration
Parse a duration lexical value as specified by XML Schama.void
Methods inherited from class gnu.math.Quantity
abs, add, addReversed, compare, compareReversed, dimensions, divide, divReversed, doubleImagValue, doubleJmagValue, doubleKmagValue, doubleValue, im, imValue, jm, jmValue, km, kmValue, make, make, make, neg, re, reValue, times, toString
Methods inherited from class gnu.math.Numeric
add, asNumericOrNull, div_inv, floatValue, geq, grt, intValue, longValue, mul_ident, power, sub, toExact, toInexact
Methods inherited from class java.lang.Number
byteValue, shortValue
-
Field Details
-
unit
-
-
Constructor Details
-
Duration
public Duration()
-
-
Method Details
-
make
-
makeMonths
-
makeMinutes
-
parse
-
parseDuration
-
parseYearMonthDuration
-
parseDayTimeDuration
-
valueOf
Parse a duration lexical value as specified by XML Schama. Return null if invalid syntax. -
add
Description copied from class:Numeric
Return this + k * obj. -
mul
-
mulReversed
- Overrides:
mulReversed
in classQuantity
-
div
-
div
-
add
-
times
-
compare
-
compare
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). -
toString
-
getYears
public int getYears()The number of years in the canonical representation. -
getMonths
public int getMonths() -
getDays
public int getDays() -
getHours
public int getHours() -
getMinutes
public int getMinutes() -
getSecondsOnly
public int getSecondsOnly() -
getNanoSecondsOnly
public int getNanoSecondsOnly() -
getTotalMonths
public int getTotalMonths() -
getTotalSeconds
public long getTotalSeconds() -
getTotalMinutes
public long getTotalMinutes() -
getNanoSeconds
public long getNanoSeconds() -
isZero
public boolean isZero() -
isExact
public boolean isExact() -
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
unit
-
number
-
hashCode
public int hashCode() -
equals
Compare for equality. Ignores unit. -
equals
Compare for equality. Ignores unit.
-