/** * Negated version of current object * * @return negated version */ public DvDuration negate() { return new DvDuration(getOtherReferenceRanges(), getNormalRange(), getNormalStatus(), getAccuracy(), isAccuracyPercent(), getMagnitudeStatus(), negatePeriod(period)); }
/** * Negated version of current object * * @return negated version */ public DvDuration negate() { return new DvDuration(getOtherReferenceRanges(), getNormalRange(), getNormalStatus(), getAccuracy(), isAccuracyPercent(), getMagnitudeStatus(), negatePeriod(period)); }
/** * Difference of this quantity and another whose formal type must be the * difference type of this quantity type. * * @param q * @return product of substraction * @throws ClassCastException */ @Override public DvQuantified<DvDuration> subtract(DvQuantified q) { final DvDuration d = (DvDuration) q; DateTime dt = new DateTime(0); Duration duration = period.toDurationFrom(dt); Duration result = duration.minus(d.period.toDurationFrom(dt)); Period p = result.toPeriodFrom(dt); return new DvDuration(d.getOtherReferenceRanges(), d.getNormalRange(), d.getNormalStatus(), d.getAccuracy(), d.isAccuracyPercent(), d.getMagnitudeStatus(), p); }
/** * Sum of this quantity and another whose formal type must be the difference * type of this quantity. * * @param q * @return production of addition * @throws ClassCastException */ @Override public DvQuantified<DvDuration> add(DvQuantified q) { final DvDuration d = (DvDuration) q; DateTime dt = new DateTime(0); Duration duration = period.toDurationFrom(dt); Duration result = duration.plus(d.period.toDurationFrom(dt)); Period p = result.toPeriodFrom(dt); return new DvDuration(d.getOtherReferenceRanges(), d.getNormalRange(), d.getNormalStatus(), d.getAccuracy(), d.isAccuracyPercent(), d.getMagnitudeStatus(), p); }
/** * Sum of this quantity and another whose formal type must be the difference * type of this quantity. * * @param q * @return production of addition * @throws ClassCastException */ @Override public DvQuantified<DvDuration> add(DvQuantified q) { final DvDuration d = (DvDuration) q; DateTime dt = new DateTime(0); Duration duration = period.toDurationFrom(dt); Duration result = duration.plus(d.period.toDurationFrom(dt)); Period p = result.toPeriodFrom(dt); return new DvDuration(d.getOtherReferenceRanges(), d.getNormalRange(), d.getNormalStatus(), d.getAccuracy(), d.isAccuracyPercent(), d.getMagnitudeStatus(), p); }
/** * Difference of this quantity and another whose formal type must be the * difference type of this quantity type. * * @param q * @return product of substraction * @throws ClassCastException */ @Override public DvQuantified<DvDuration> subtract(DvQuantified q) { final DvDuration d = (DvDuration) q; DateTime dt = new DateTime(0); Duration duration = period.toDurationFrom(dt); Duration result = duration.minus(d.period.toDurationFrom(dt)); Period p = result.toPeriodFrom(dt); return new DvDuration(d.getOtherReferenceRanges(), d.getNormalRange(), d.getNormalStatus(), d.getAccuracy(), d.isAccuracyPercent(), d.getMagnitudeStatus(), p); }