Package org.apache.groovy.dateutil
Class DatumDependentDuration
java.lang.Object
org.apache.groovy.dateutil.BaseDuration
org.apache.groovy.dateutil.DatumDependentDuration
- All Implemented Interfaces:
Comparable<BaseDuration>
- Direct Known Subclasses:
TimeDatumDependentDuration
A duration that includes years and/or months, whose exact length depends on the datum.
DEQUIRKED: toMilliseconds() is now deterministic (see BaseDuration); it
no longer resolves against "now". getAgo()/getFrom() are inherited and no
longer zero the time-of-day.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.groovy.dateutil.BaseDuration
BaseDuration.From -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionDatumDependentDuration(int years, int months, int days, int hours, int minutes, int seconds, int millis) Stores years, months, and the day and time components. -
Method Summary
Modifier and TypeMethodDescriptionSubtracts every component ofrhs, including years and months.Subtracts the day and time components ofrhs.Adds every component ofrhs, including years and months.Adds the day and time components ofrhs.Adds this duration torhsby callingrhs.plus(this), so the result is aTimeDatumDependentDuration.plus(TimeDuration rhs) Adds this duration torhsby callingrhs.plus(this).Methods inherited from class org.apache.groovy.dateutil.BaseDuration
compareTo, getAgo, getDays, getFrom, getHours, getMillis, getMinutes, getMonths, getSeconds, getYears, plus, toMilliseconds, toString
-
Constructor Details
-
DatumDependentDuration
public DatumDependentDuration(int years, int months, int days, int hours, int minutes, int seconds, int millis) Stores years, months, and the day and time components.- Parameters:
years- whole yearsmonths- whole monthsdays- whole dayshours- hoursminutes- minutesseconds- secondsmillis- milliseconds
-
-
Method Details
-
plus
Adds every component ofrhs, including years and months. The components are not normalized.- Parameters:
rhs- duration to add- Returns:
- the component-wise sum
-
plus
Adds this duration torhsby callingrhs.plus(this), so the result is aTimeDatumDependentDuration.- Parameters:
rhs- duration to add- Returns:
- the sum, typed as
rhscomputes it
-
plus
Adds the day and time components ofrhs. Years and months stay those of this duration. The components are not normalized.- Parameters:
rhs- duration to add- Returns:
- the component-wise sum
-
plus
Adds this duration torhsby callingrhs.plus(this).TimeDuration.plusreturns aTimeDatumDependentDuration.- Parameters:
rhs- duration to add- Returns:
- the sum, typed as
rhscomputes it
-
minus
Subtracts every component ofrhs, including years and months. The components are not normalized.- Parameters:
rhs- duration to subtract- Returns:
- the component-wise difference
-
minus
Subtracts the day and time components ofrhs. Years and months stay those of this duration. The components are not normalized.- Parameters:
rhs- duration to subtract- Returns:
- the component-wise difference
-