Package org.joda.time.chrono
Class GJChronology.LinkedDurationField
- java.lang.Object
-
- org.joda.time.DurationField
-
- org.joda.time.field.BaseDurationField
-
- org.joda.time.field.DecoratedDurationField
-
- org.joda.time.chrono.GJChronology.LinkedDurationField
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<DurationField>
- Enclosing class:
- GJChronology
private static class GJChronology.LinkedDurationField extends DecoratedDurationField
Links the duration back to a ImpreciseCutoverField.
-
-
Field Summary
Fields Modifier and Type Field Description private GJChronology.ImpreciseCutoverFieldiFieldprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description LinkedDurationField(DurationField durationField, GJChronology.ImpreciseCutoverField dateTimeField)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longadd(long instant, int value)Adds a duration value (which may be negative) to the instant.longadd(long instant, long value)Adds a duration value (which may be negative) to the instant.intgetDifference(long minuendInstant, long subtrahendInstant)Computes the difference between two instants, as measured in the units of this field.longgetDifferenceAsLong(long minuendInstant, long subtrahendInstant)Computes the difference between two instants, as measured in the units of this field.-
Methods inherited from class org.joda.time.field.DecoratedDurationField
getMillis, getMillis, getUnitMillis, getValueAsLong, getWrappedField, isPrecise
-
Methods inherited from class org.joda.time.field.BaseDurationField
compareTo, getMillis, getMillis, getName, getType, getValue, getValue, getValueAsLong, isSupported, toString
-
Methods inherited from class org.joda.time.DurationField
subtract, subtract
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
iField
private final GJChronology.ImpreciseCutoverField iField
-
-
Constructor Detail
-
LinkedDurationField
LinkedDurationField(DurationField durationField, GJChronology.ImpreciseCutoverField dateTimeField)
-
-
Method Detail
-
add
public long add(long instant, int value)Description copied from class:DurationFieldAdds a duration value (which may be negative) to the instant.- Overrides:
addin classDecoratedDurationField- Parameters:
instant- the milliseconds from 1970-01-01T00:00:00Z to add tovalue- the value to add, in the units of the field- Returns:
- the updated milliseconds
-
add
public long add(long instant, long value)Description copied from class:DurationFieldAdds a duration value (which may be negative) to the instant.- Overrides:
addin classDecoratedDurationField- Parameters:
instant- the milliseconds from 1970-01-01T00:00:00Z to add tovalue- the value to add, in the units of the field- Returns:
- the updated milliseconds
-
getDifference
public int getDifference(long minuendInstant, long subtrahendInstant)Description copied from class:DurationFieldComputes the difference between two instants, as measured in the units of this field. Any fractional units are dropped from the result. Calling getDifference reverses the effect of calling add. In the following code:long instant = ... int v = ... int age = getDifference(add(instant, v), instant);
The value 'age' is the same as the value 'v'.- Overrides:
getDifferencein classBaseDurationField- Parameters:
minuendInstant- the milliseconds from 1970-01-01T00:00:00Z to subtract fromsubtrahendInstant- the milliseconds from 1970-01-01T00:00:00Z to subtract off the minuend- Returns:
- the difference in the units of this field
-
getDifferenceAsLong
public long getDifferenceAsLong(long minuendInstant, long subtrahendInstant)Description copied from class:DurationFieldComputes the difference between two instants, as measured in the units of this field. Any fractional units are dropped from the result. Calling getDifference reverses the effect of calling add. In the following code:long instant = ... long v = ... long age = getDifferenceAsLong(add(instant, v), instant);
The value 'age' is the same as the value 'v'.- Overrides:
getDifferenceAsLongin classDecoratedDurationField- Parameters:
minuendInstant- the milliseconds from 1970-01-01T00:00:00Z to subtract fromsubtrahendInstant- the milliseconds from 1970-01-01T00:00:00Z to subtract off the minuend- Returns:
- the difference in the units of this field
-
-