org.joda.time.field
Class BaseDurationField
- Comparable, Serializable
public abstract class BaseDurationField
implements Serializable
BaseDurationField provides the common behaviour for DurationField
implementations.
This class should generally not be used directly by API users. The
DurationField class should be used when different kinds of DurationField
objects are to be referenced.
BaseDurationField is thread-safe and immutable, and its subclasses must
be as well.
int | compareTo(Object durationField)
|
int | getDifference(long minuendInstant, long subtrahendInstant)
|
long | getMillis(int value) - Get the millisecond duration of this field from its value, which is
approximate if this field is imprecise.
|
long | getMillis(long value) - Get the millisecond duration of this field from its value, which is
approximate if this field is imprecise.
|
String | getName()
|
DurationFieldType | getType()
|
int | getValue(long duration) - Get the value of this field from the milliseconds, which is approximate
if this field is imprecise.
|
int | getValue(long duration, long instant) - Get the value of this field from the milliseconds relative to an
instant.
|
long | getValueAsLong(long duration) - Get the value of this field from the milliseconds, which is approximate
if this field is imprecise.
|
boolean | isSupported()
|
String | toString() - Get a suitable debug string.
|
add , add , compareTo , getDifference , getDifferenceAsLong , getMillis , getMillis , getMillis , getMillis , getName , getType , getUnitMillis , getValue , getValue , getValueAsLong , getValueAsLong , isPrecise , isSupported , subtract , subtract , toString |
getMillis
public long getMillis(int value)
Get the millisecond duration of this field from its value, which is
approximate if this field is imprecise.
- getMillis in interface DurationField
value
- the value of the field, which may be negative
- the milliseconds that the field represents, which may be
negative
getMillis
public long getMillis(long value)
Get the millisecond duration of this field from its value, which is
approximate if this field is imprecise.
- getMillis in interface DurationField
value
- the value of the field, which may be negative
- the milliseconds that the field represents, which may be
negative
getValue
public int getValue(long duration)
Get the value of this field from the milliseconds, which is approximate
if this field is imprecise.
- getValue in interface DurationField
duration
- the milliseconds to query, which may be negative
- the value of the field, in the units of the field, which may be
negative
getValue
public int getValue(long duration,
long instant)
Get the value of this field from the milliseconds relative to an
instant.
If the milliseconds is positive, then the instant is treated as a
"start instant". If negative, the instant is treated as an "end
instant".
The default implementation returns
Utils.safeToInt(getAsLong(millisDuration, instant))
.
- getValue in interface DurationField
duration
- the milliseconds to query, which may be negativeinstant
- the start instant to calculate relative to
- the value of the field, in the units of the field, which may be
negative
getValueAsLong
public long getValueAsLong(long duration)
Get the value of this field from the milliseconds, which is approximate
if this field is imprecise.
- getValueAsLong in interface DurationField
duration
- the milliseconds to query, which may be negative
- the value of the field, in the units of the field, which may be
negative
Copyright (c) 2001-2006 - Joda.org