/** * Gets a copy of this instant with the specified duration added. * <p> * If the amount is zero or null, then <code>this</code> is returned. * * @param duration the duration to add to this one, null means zero * @return a copy of this instant with the duration added * @throws ArithmeticException if the new instant exceeds the capacity of a long */ public Instant plus(ReadableDuration duration) { return withDurationAdded(duration, 1); }
/** * Gets a copy of this instant with the specified duration taken away. * <p> * If the amount is zero or null, then <code>this</code> is returned. * * @param duration the duration to reduce this instant by * @return a copy of this instant with the duration taken away * @throws ArithmeticException if the new instant exceeds the capacity of a long */ public Instant minus(ReadableDuration duration) { return withDurationAdded(duration, -1); }
/** * Gets a copy of this instant with the specified duration added. * <p> * If the amount is zero or null, then <code>this</code> is returned. * * @param duration the duration to add to this one * @return a copy of this instant with the duration added * @throws ArithmeticException if the new instant exceeds the capacity of a long */ public Instant plus(long duration) { return withDurationAdded(duration, 1); }
/** * Gets a copy of this instant with the specified duration taken away. * <p> * If the amount is zero or null, then <code>this</code> is returned. * * @param duration the duration to reduce this instant by * @return a copy of this instant with the duration taken away * @throws ArithmeticException if the new instant exceeds the capacity of a long */ public Instant minus(long duration) { return withDurationAdded(duration, -1); }
/** * Gets a copy of this instant with the specified duration taken away. * <p> * If the amount is zero or null, then <code>this</code> is returned. * * @param duration the duration to reduce this instant by * @return a copy of this instant with the duration taken away * @throws ArithmeticException if the new instant exceeds the capacity of a long */ public Instant minus(long duration) { return withDurationAdded(duration, -1); }
/** * Gets a copy of this instant with the specified duration taken away. * <p> * If the amount is zero or null, then <code>this</code> is returned. * * @param duration the duration to reduce this instant by * @return a copy of this instant with the duration taken away * @throws ArithmeticException if the new instant exceeds the capacity of a long */ public Instant minus(ReadableDuration duration) { return withDurationAdded(duration, -1); }
/** * Gets a copy of this instant with the specified duration added. * <p> * If the amount is zero or null, then <code>this</code> is returned. * * @param duration the duration to add to this one * @return a copy of this instant with the duration added * @throws ArithmeticException if the new instant exceeds the capacity of a long */ public Instant plus(long duration) { return withDurationAdded(duration, 1); }
/** * Gets a copy of this instant with the specified duration added. * <p> * If the amount is zero or null, then <code>this</code> is returned. * * @param duration the duration to add to this one, null means zero * @return a copy of this instant with the duration added * @throws ArithmeticException if the new instant exceeds the capacity of a long */ public Instant plus(ReadableDuration duration) { return withDurationAdded(duration, 1); }
/** * Gets a copy of this instant with the specified duration added. * <p> * If the addition is zero, then <code>this</code> is returned. * * @param durationToAdd the duration to add to this one, null means zero * @param scalar the amount of times to add, such as -1 to subtract once * @return a copy of this instant with the duration added * @throws ArithmeticException if the new instant exceeds the capacity of a long */ public Instant withDurationAdded(ReadableDuration durationToAdd, int scalar) { if (durationToAdd == null || scalar == 0) { return this; } return withDurationAdded(durationToAdd.getMillis(), scalar); }
/** * Gets a copy of this instant with the specified duration added. * <p> * If the addition is zero, then <code>this</code> is returned. * * @param durationToAdd the duration to add to this one, null means zero * @param scalar the amount of times to add, such as -1 to subtract once * @return a copy of this instant with the duration added * @throws ArithmeticException if the new instant exceeds the capacity of a long */ public Instant withDurationAdded(ReadableDuration durationToAdd, int scalar) { if (durationToAdd == null || scalar == 0) { return this; } return withDurationAdded(durationToAdd.getMillis(), scalar); }
public static Partial addForce(Partial p, Period d, int scalar) { Instant t = getInstant(p); t = t.withDurationAdded(d.toDurationFrom(INSTANT_ZERO), scalar); return getPartial(t, p); }
@Override public Time add(Duration offset) { Period p = offset.getJodaTimePeriod(); GroundedTime g = new GroundedTime(base.toInstant().withDurationAdded(p.toDurationFrom(base), 1)); g.approx = this.approx; g.mod = this.mod; return g; }
/** * Gets a copy of this instant with the specified duration added. * <p> * If the amount is zero or null, then <code>this</code> is returned. * * @param duration the duration to add to this one * @return a copy of this instant with the duration added * @throws ArithmeticException if the new instant exceeds the capacity of a long */ public Instant plus(long duration) { return withDurationAdded(duration, 1); }
/** * Gets a copy of this instant with the specified duration added. * <p> * If the amount is zero or null, then <code>this</code> is returned. * * @param duration the duration to add to this one, null means zero * @return a copy of this instant with the duration added * @throws ArithmeticException if the new instant exceeds the capacity of a long */ public Instant plus(ReadableDuration duration) { return withDurationAdded(duration, 1); }
/** * Gets a copy of this instant with the specified duration taken away. * <p> * If the amount is zero or null, then <code>this</code> is returned. * * @param duration the duration to reduce this instant by * @return a copy of this instant with the duration taken away * @throws ArithmeticException if the new instant exceeds the capacity of a long */ public Instant minus(long duration) { return withDurationAdded(duration, -1); }
/** * Gets a copy of this instant with the specified duration taken away. * <p> * If the amount is zero or null, then <code>this</code> is returned. * * @param duration the duration to reduce this instant by * @return a copy of this instant with the duration taken away * @throws ArithmeticException if the new instant exceeds the capacity of a long */ public Instant minus(ReadableDuration duration) { return withDurationAdded(duration, -1); }
/** * Gets a copy of this instant with the specified duration added. * <p> * If the addition is zero, then <code>this</code> is returned. * * @param durationToAdd the duration to add to this one, null means zero * @param scalar the amount of times to add, such as -1 to subtract once * @return a copy of this instant with the duration added * @throws ArithmeticException if the new instant exceeds the capacity of a long */ public Instant withDurationAdded(ReadableDuration durationToAdd, int scalar) { if (durationToAdd == null || scalar == 0) { return this; } return withDurationAdded(durationToAdd.getMillis(), scalar); }
/** * Gets a copy of this instant with the specified duration taken away. * <p> * If the amount is zero or null, then <code>this</code> is returned. * * @param duration the duration to reduce this instant by * @return a copy of this instant with the duration taken away * @throws ArithmeticException if the new instant exceeds the capacity of a long */ public Instant minus(ReadableDuration duration) { return withDurationAdded(duration, -1); }
/** * Gets a copy of this instant with the specified duration added. * <p> * If the amount is zero or null, then <code>this</code> is returned. * * @param duration the duration to add to this one, null means zero * @return a copy of this instant with the duration added * @throws ArithmeticException if the new instant exceeds the capacity of a long */ public Instant plus(ReadableDuration duration) { return withDurationAdded(duration, 1); }
public static Partial addForce(Partial p, Period d, int scalar) { Instant t = getInstant(p); t = t.withDurationAdded(d.toDurationFrom(INSTANT_ZERO), scalar); return getPartial(t, p); }