Interface AdjustableElement<V,T>
- Type Parameters:
V
- generic type of element valuesT
- generic type of target entity an operator is applied to
- All Superinterfaces:
ChronoElement<V>
,Comparator<ChronoDisplay>
,ZonalElement<V>
- All Known Subinterfaces:
NavigableElement<V>
,OrdinalWeekdayElement
,ProportionalElement<V,T>
Extends a chronological element by some standard ways of manipulation.
- Author:
- Meno Hochschild
-
Method Summary
Modifier and TypeMethodDescriptionRounds up an entity by setting all child elements to maximum.default ChronoOperator<T>
CombinesnewValue(V)
and thenatCeiling()
.atFloor()
Rounds down an entity by setting all child elements to minimum.default ChronoOperator<T>
CombinesnewValue(V)
and thenatFloor()
.Adjusts any local entity such that this element gets the previous value.Adjusts any local entity such that this element gets the next value.Sets any local entity to the maximum of this element.Sets any local entity to the minimum of this element.Sets any local entity to given new value of this element.Methods inherited from interface net.time4j.engine.ChronoElement
compare, getDefaultMaximum, getDefaultMinimum, getDisplayName, getSymbol, getType, isDateElement, isLenient, isTimeElement, name
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Methods inherited from interface net.time4j.ZonalElement
at, atUTC, in, inStdTimezone, inTimezone
-
Method Details
-
newValue
Sets any local entity to given new value of this element.
- Parameters:
value
- new element value- Returns:
- operator directly applicable also on
PlainTimestamp
- Since:
- 2.0
- See Also:
ChronoEntity.with(ChronoElement, V)
-
minimized
ElementOperator<T> minimized()Sets any local entity to the minimum of this element.
- Returns:
- operator directly applicable also on
PlainTimestamp
-
maximized
ElementOperator<T> maximized()Sets any local entity to the maximum of this element.
- Returns:
- operator directly applicable also on
PlainTimestamp
-
decremented
ElementOperator<T> decremented()Adjusts any local entity such that this element gets the previous value.
The operator throws a
ChronoException
if there is no base unit available for this element.- Returns:
- operator directly applicable also on
PlainTimestamp
and requiring a base unit in given chronology for decrementing - See Also:
TimeAxis.getBaseUnit(ChronoElement)
-
incremented
ElementOperator<T> incremented()Adjusts any local entity such that this element gets the next value.
The operator throws a
ChronoException
if there is no base unit available for this element.- Returns:
- operator directly applicable also on
PlainTimestamp
and requiring a base unit in given chronology for incrementing - See Also:
TimeAxis.getBaseUnit(ChronoElement)
-
atFloor
ElementOperator<T> atFloor()Rounds down an entity by setting all child elements to minimum.
Many elements are organized by parent-child-relations. The most important dependency chain is: YEAR -> MONTH -> DAY_OF_MONTH -> HOUR_OF_DAY -> MINUTE -> SECOND -> NANO_OF_SECOND. If there is no child element then this operator will not do anything (no-op). Example:
PlainDate date = PlainDate.of(2016, 11, 24); // DAY_OF_WEEK has no time element as child in context of plain calendar dates System.out.println(date.with(DAY_OF_WEEK.atFloor())); // 2016-11-24 PlainTimestamp tsp = date.atTime(20, 45); // DAY_OF_WEEK has now child elements which can be set to zero System.out.println(tsp.with(DAY_OF_WEEK.atFloor())); // 2016-11-24T00
- Returns:
- operator directly applicable on local types without timezone
-
atCeiling
ElementOperator<T> atCeiling()Rounds up an entity by setting all child elements to maximum.
Many elements are organized by parent-child-relations. The most important dependency chain is: YEAR -> MONTH -> DAY_OF_MONTH -> HOUR_OF_DAY -> MINUTE -> SECOND -> NANO_OF_SECOND. If there is no child element then this operator will not do anything (no-op). Example:
PlainDate date = PlainDate.of(2016, 11, 24); // DAY_OF_WEEK has no time element as child in context of plain calendar dates System.out.println(date.with(DAY_OF_WEEK.atCeiling())); // 2016-11-24 PlainTimestamp tsp = date.atTime(20, 45); // DAY_OF_WEEK has now child elements which can be all maximized System.out.println(tsp.with(DAY_OF_WEEK.atCeiling())); // 2016-11-24T23:59:59,999999999
- Returns:
- operator directly applicable on local types without timezone
-
atFloor
Combines
newValue(V)
and thenatFloor()
.Example:
PlainTime time = PlainTime.nowInSystemTime(); assertThat( time.with(PlainTime.DIGITAL_HOUR_OF_DAY.atFloor(7)), is(PlainTime.of(7, 0)));
- Parameters:
value
- new element value- Returns:
- combined operator
- Since:
- 4.33
- See Also:
ChronoEntity.with(ChronoElement, V)
,newValue(V)
,atFloor()
-
atCeiling
Combines
newValue(V)
and thenatCeiling()
.- Parameters:
value
- new element value- Returns:
- combined operator
- Since:
- 4.33
- See Also:
ChronoEntity.with(ChronoElement, V)
,newValue(V)
,atCeiling()
-