Interface NavigableElement<V extends Enum<V>>
- Type Parameters:
V
- generic enum type of element values
- All Superinterfaces:
AdjustableElement<V,PlainDate>
,ChronoElement<V>
,Comparator<ChronoDisplay>
,ZonalElement<V>
Defines additional enum-based operators for setting new element values taking into account the old element value.
- Author:
- Meno Hochschild
-
Method Summary
Modifier and TypeMethodDescriptionMoves a time point to the first given element value which is after the current element value.setToNextOrSame(V value)
Moves a time point to the first given element value which is after or equal to the current element value.setToPrevious(V value)
Moves a time point to the first given element value which is before the current element value.setToPreviousOrSame(V value)
Moves a time point to the first given element value which is before or equal to the current element value.Methods inherited from interface net.time4j.AdjustableElement
atCeiling, atCeiling, atFloor, atFloor, decremented, incremented, maximized, minimized, newValue
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
-
setToNext
Moves a time point to the first given element value which is after the current element value.
Example for a date which shall be moved to a special weekday:
import static net.time4j.Month.MARCH; import static net.time4j.PlainDate.DAY_OF_WEEK; import static net.time4j.Weekday.MONDAY; PlainDate date = PlainDate.of(2013, MARCH, 7); // Thursday System.out.println(date.with(DAY_OF_WEEK.setToNext(MONDAY))); // output: 2013-03-11 (first monday after march 7th)
- Parameters:
value
- new element value which is after current value- Returns:
- operator directly applicable also on
PlainTimestamp
-
setToPrevious
Moves a time point to the first given element value which is before the current element value.
Example for a date which shall be moved to a special weekday:
import static net.time4j.IsoElement.DAY_OF_WEEK; import static net.time4j.Month.MARCH; import static net.time4j.Weekday.THURSDAY; PlainDate date = PlainDate.of(2013, MARCH, 7); // Thursday System.out.println(date.with(DAY_OF_WEEK.setToPrevious(THURSDAY))); // output: 2013-02-28 (Thursday one week earlier)
- Parameters:
value
- new element value which is before current value- Returns:
- operator directly applicable also on
PlainTimestamp
-
setToNextOrSame
Moves a time point to the first given element value which is after or equal to the current element value.
Is the current element value equal to the given element value then there is no movement.
- Parameters:
value
- new element value which is either after current value or the same- Returns:
- operator directly applicable also on
PlainTimestamp
-
setToPreviousOrSame
Moves a time point to the first given element value which is before or equal to the current element value.
Is the current element value equal to the given element value then there is no movement.
- Parameters:
value
- new element value which is either before current value or the same- Returns:
- operator directly applicable also on
PlainTimestamp
-