public int getDifference(long minuendInstant, long subtrahendInstant) { return FieldUtils.safeToInt(getDifferenceAsLong(minuendInstant, subtrahendInstant)); }
/** * Get a suitable debug string. * * @return debug string */ public String toString() { return "DurationField[" + getName() + ']'; }
/** * Get the millisecond duration of this field from its value, which is * approximate if this field is imprecise. * * @param value the value of the field, which may be negative * @return the milliseconds that the field represents, which may be * negative */ public long getMillis(int value) { return value * getUnitMillis(); // safe }
/** * Get the value of this field from the milliseconds, which is approximate * if this field is imprecise. * * @param duration the milliseconds to query, which may be negative * @return the value of the field, in the units of the field, which may be * negative */ public int getValue(long duration) { return FieldUtils.safeToInt(getValueAsLong(duration)); }
/** * Get the value of this field from the milliseconds, which is approximate * if this field is imprecise. * * @param duration the milliseconds to query, which may be negative * @return the value of the field, in the units of the field, which may be * negative */ public int getValue(long duration) { return FieldUtils.safeToInt(getValueAsLong(duration)); }
/** * Get the value of this field from the milliseconds, which is approximate * if this field is imprecise. * * @param duration the milliseconds to query, which may be negative * @return the value of the field, in the units of the field, which may be * negative */ public long getValueAsLong(long duration) { return duration / getUnitMillis(); }
/** * Get the value of this field from the milliseconds relative to an * instant. * * <p>If the milliseconds is positive, then the instant is treated as a * "start instant". If negative, the instant is treated as an "end * instant". * * <p>The default implementation returns * <code>Utils.safeToInt(getAsLong(millisDuration, instant))</code>. * * @param duration the milliseconds to query, which may be negative * @param instant the start instant to calculate relative to * @return the value of the field, in the units of the field, which may be * negative */ public int getValue(long duration, long instant) { return FieldUtils.safeToInt(getValueAsLong(duration, instant)); }
/** * Get a suitable debug string. * * @return debug string */ public String toString() { return "DurationField[" + getName() + ']'; }
public int getDifference(long minuendInstant, long subtrahendInstant) { return FieldUtils.safeToInt(getDifferenceAsLong(minuendInstant, subtrahendInstant)); }
/** * Get the value of this field from the milliseconds, which is approximate * if this field is imprecise. * * @param duration the milliseconds to query, which may be negative * @return the value of the field, in the units of the field, which may be * negative */ public long getValueAsLong(long duration) { return duration / getUnitMillis(); }
/** * Get the value of this field from the milliseconds relative to an * instant. * * <p>If the milliseconds is positive, then the instant is treated as a * "start instant". If negative, the instant is treated as an "end * instant". * * <p>The default implementation returns * <code>Utils.safeToInt(getAsLong(millisDuration, instant))</code>. * * @param duration the milliseconds to query, which may be negative * @param instant the start instant to calculate relative to * @return the value of the field, in the units of the field, which may be * negative */ public int getValue(long duration, long instant) { return FieldUtils.safeToInt(getValueAsLong(duration, instant)); }
/** * Get a suitable debug string. * * @return debug string */ public String toString() { return "DurationField[" + getName() + ']'; }
public int getDifference(long minuendInstant, long subtrahendInstant) { return FieldUtils.safeToInt(getDifferenceAsLong(minuendInstant, subtrahendInstant)); }
/** * Get the millisecond duration of this field from its value, which is * approximate if this field is imprecise. * * @param value the value of the field, which may be negative * @return the milliseconds that the field represents, which may be * negative */ public long getMillis(int value) { return value * getUnitMillis(); // safe }
/** * Get the value of this field from the milliseconds, which is approximate * if this field is imprecise. * * @param duration the milliseconds to query, which may be negative * @return the value of the field, in the units of the field, which may be * negative */ public int getValue(long duration) { return FieldUtils.safeToInt(getValueAsLong(duration)); }
/** * Get a suitable debug string. * * @return debug string */ public String toString() { return "DurationField[" + getName() + ']'; }
public int getDifference(long minuendInstant, long subtrahendInstant) { return FieldUtils.safeToInt(getDifferenceAsLong(minuendInstant, subtrahendInstant)); }
/** * Get the millisecond duration of this field from its value, which is * approximate if this field is imprecise. * * @param value the value of the field, which may be negative * @return the milliseconds that the field represents, which may be * negative */ public long getMillis(long value) { return FieldUtils.safeMultiply(value, getUnitMillis()); }
/** * Get the value of this field from the milliseconds relative to an * instant. * * <p>If the milliseconds is positive, then the instant is treated as a * "start instant". If negative, the instant is treated as an "end * instant". * * <p>The default implementation returns * <code>Utils.safeToInt(getAsLong(millisDuration, instant))</code>. * * @param duration the milliseconds to query, which may be negative * @param instant the start instant to calculate relative to * @return the value of the field, in the units of the field, which may be * negative */ public int getValue(long duration, long instant) { return FieldUtils.safeToInt(getValueAsLong(duration, instant)); }
/** * Get a suitable debug string. * * @return debug string */ public String toString() { return "DurationField[" + getName() + ']'; }