Uses of Class
net.time4j.Duration
Package
Description
The main package contains four basic types of ISO-8601, namely
PlainDate
, PlainTime
, PlainTimestamp
and Moment
.Interval support.
Bridge to XML.
-
Uses of Duration in net.time4j
Modifier and TypeFieldDescriptionstatic TemporalType<Duration,Duration<ClockUnit>>
TemporalType.THREETEN_DURATION
Bridge between the JSR-310-classjava.time.Duration
and the classnet.time4j.Duration
.static TemporalType<Period,Duration<CalendarUnit>>
TemporalType.THREETEN_PERIOD
Bridge between the JSR-310-classjava.time.Period
and the classnet.time4j.Duration
.Modifier and TypeMethodDescriptionDuration.abs()
Gets the absolute always non-negative copy of this duration.Duration.Builder.build()
Creates a new duration conforming to ISO-8601.Duration.compose(Duration<CalendarUnit> calendarPeriod, Duration<ClockUnit> clockPeriod)
Creates a composition of a calendar period and a clock period.Short cut forTemporalType.THREETEN_DURATION.translate(threetenDuration)
.static Duration<CalendarUnit>
Short cut forTemporalType.THREETEN_PERIOD.translate(threetenPeriod)
.Duration.from(TemporalAmount threeten)
Tries to convert given temporal amount to a duration.Duration.inverse()
Gets a copy of this duration with reversed sign.Duration.multipliedBy(int factor)
Multiplies all partial amounts of this duration by given factor.PlainDate.normalize(TimeSpan<? extends CalendarUnit> timespan)
Normalized given timespan using years, months and days.Normalizes given timespan using years, months, days and all clock units.Duration.of(long amount, U unit)
Creates a new duration which only knows one unit.static Duration<CalendarUnit>
Duration.ofCalendarUnits(int years, int months, int days)
Creates a positive duration in years, months and days.Duration.ofClockUnits(int hours, int minutes, int seconds)
Creates a positive duratioon in hours, minutes and seconds.Duration.ofZero()
Gets an empty duration without units.static Duration<CalendarUnit>
Duration.parseCalendarPeriod(String period)
Parses a canonical representation with only date units to a calendrical duration.Duration.parseClockPeriod(String period)
Parses a canonical representation with only wall time units to a time-only duration.Duration.parsePeriod(String period)
Parses a canonical representation to a duration.static Duration<IsoDateUnit>
Duration.parseWeekBasedPeriod(String period)
Parses a canonical representation with only week-based units (Y, W and D) to a calendrical duration where years are interpreted as week-based years with either 364 days (= 52 weeks) or 371 days (= 53 weeks).Gets a copy of this duration where given amount will be added to the partial amount of this duration in given unit.Creates a duration as union of this instance and given timespan where partial amounts of equal units will be summed up.Duration.toCalendarPeriod()
Extracts a new duration with all contained calendar units only.Duration.toClockPeriod()
Extracts a new duration with all contained clock units only.Duration.toClockPeriodWithDaysAs24Hours()
Extracts a new duration with all contained clock units only.Duration.truncatedTo(U unit)
Sets all duration parts to zero whose unit has a smaller length than given unit.Gets a copy of this duration where the partial amount associated with given time unit is changed.Duration.with(Normalizer<U> normalizer)
Normalizes this duration by given normalizer.Modifier and TypeMethodDescriptionstatic <U extends IsoUnit, T extends TimePoint<U, T>>
Comparator<Duration<? extends U>>Duration.comparator(T base)
Creates aComparator
which compares durations based on their lengths.static Comparator<Duration<ClockUnit>>
Duration.comparatorOnClock()
Obtains a comparator suitable for Durations based on clock units.static <U extends IsoUnit>
TimeMetric<U,Duration<U>>Duration.in(Collection<? extends U> units)
Constructs a metric for any kind of standard units in normalized form.static TimeMetric<IsoUnit,Duration<IsoUnit>>
Helps to evaluate the zonal duration between two timestamps and applies an offset correction if necessary.static <U extends IsoUnit>
TimeMetric<U,Duration<U>>Duration.in(U... units)
Constructs a metric for any kind of standard units in normalized form.static TimeMetric<ClockUnit,Duration<ClockUnit>>
Duration.inClockUnits()
Constructs a metric in hours, minutes, seconds and nanoseconds.static TimeMetric<IsoDateUnit,Duration<IsoDateUnit>>
Duration.inWeekBasedUnits()
Constructs a metric in week-based years, weeks and days.static TimeMetric<CalendarUnit,Duration<CalendarUnit>>
Duration.inYearsMonthsDays()
Constructs a metric in years, months and days.Duration.summingUp()
Helps to sum up durations of a stream.Duration.summingUp()
Helps to sum up durations of a stream.Creates a duration as union of this instance and given timespan where partial amounts of equal units will be summed up.Modifier and TypeMethodDescriptionDuration.compose(Duration<CalendarUnit> calendarPeriod, Duration<ClockUnit> clockPeriod)
Creates a composition of a calendar period and a clock period.Formats the total given duration.Formats the total given duration.Formats given duration. -
Uses of Duration in net.time4j.range
Modifier and TypeMethodDescriptionClockInterval.getDuration()
Yields the length of this interval.DateInterval.getDuration(CalendarUnit... units)
Yields the length of this interval in given calendrical units.TimestampInterval.getDuration(Timezone tz, IsoUnit... units)
Yields the length of this interval in given units and applies a timezone offset correction .TimestampInterval.getDuration(U... units)
Yields the length of this interval in given units.DateInterval.getDurationInYearsMonthsDays()
Yields the length of this interval in years, months and days.MomentInterval.getNominalDuration(Timezone tz, IsoUnit... units)
Yields the nominal duration of this interval in given timezone and units.SingleUnitTimeSpan.toStdDuration()
Converts this instance to a general duration with the same amount and unit.Modifier and TypeMethodDescriptionstatic IsoRecurrence<MomentInterval>
IsoRecurrence.of(int count, Duration<?> duration, Moment end, ZonalOffset offset)
Creates a recurrent backward sequence of moment intervals having given duration.static IsoRecurrence<TimestampInterval>
IsoRecurrence.of(int count, Duration<?> duration, PlainTimestamp end)
Creates a recurrent backward sequence of timestamp intervals having given duration.static IsoRecurrence<DateInterval>
IsoRecurrence.of(int count, Duration<? extends IsoDateUnit> duration, PlainDate end)
Creates a recurrent backward sequence of date intervals having given duration.static IsoRecurrence<MomentInterval>
IsoRecurrence.of(int count, Moment start, Duration<?> duration, ZonalOffset offset)
Creates a recurrent sequence of moment intervals having given duration.static IsoRecurrence<DateInterval>
IsoRecurrence.of(int count, PlainDate start, Duration<? extends IsoDateUnit> duration)
Creates a recurrent sequence of date intervals having given duration.static IsoRecurrence<TimestampInterval>
IsoRecurrence.of(int count, PlainTimestamp start, Duration<?> duration)
Creates a recurrent sequence of timestamp intervals having given duration.Obtains a stream iterating over every clock time which is the result of addition of given duration to start until the end of this interval is reached.Obtains a stream iterating over every clock time which is the result of addition of given duration to start until the end is reached.DateInterval.stream(Duration<CalendarUnit> duration)
Obtains a stream iterating over every calendar date which is the result of addition of given duration to start until the end of this interval is reached.DateInterval.stream(Duration<CalendarUnit> duration, PlainDate start, PlainDate end)
Obtains a stream iterating over every calendar date which is the result of addition of given duration to start until the end is reached.Obtains a stream iterating over every timestamp which is the result of addition of given duration to start until the end of this interval is reached.static Stream<PlainTimestamp>
TimestampInterval.stream(Duration<?> duration, PlainTimestamp start, PlainTimestamp end)
Obtains a stream iterating over every timestamp which is the result of addition of given duration to start until the end is reached. -
Uses of Duration in net.time4j.xml
Modifier and TypeFieldDescriptionstatic XMLAdapter<Duration,Duration<IsoUnit>>
XMLAdapter.XML_DURATION
Bridge between a XML-duration according toxsd:duration
and the Time4J-typeDuration
.