public final class SimpleUnitResolution extends Resolution<SimpleUnit>
SimpleUnit
that can be used in combination with
the SimpleUnitDatelineModel
.DatelineModel.addResolution(Resolution)
Resolution.Position
Constructor and Description |
---|
SimpleUnitResolution(SimpleUnit unit,
String format,
int stepRate)
Constructs a new resolution for the given unit, format, step rate, and positions.
|
SimpleUnitResolution(SimpleUnit unit,
String format,
int stepRate,
Resolution.Position... supportedPositions)
Constructs a new resolution for the given unit, format, step rate, and positions.
|
Modifier and Type | Method and Description |
---|---|
VirtualGrid<SimpleUnit> |
createGrid()
Creates a virtual grid for editing operations based on the settings of this
resolution.
|
Instant |
decrement(Instant instant,
ZoneId zoneId)
Decrements the given time based on the temporal unit represented by this
resolution.
|
String |
format(Instant instant,
ZoneId zoneId)
Formats the given time / instant for the given time zone based on the
settings of this resolution.
|
Instant |
increment(Instant instant,
ZoneId zoneId)
Increments the given time based on the temporal unit represented by this
resolution.
|
Instant |
truncate(Instant temporal,
ZoneId zoneId,
DayOfWeek firstDayOfWeek)
Truncates the given time based on the temporal unit represented by this
resolution.
|
getFormat, getStepRate, getTemporalUnit, isSupportingPosition, toString
public SimpleUnitResolution(SimpleUnit unit, String format, int stepRate, Resolution.Position... supportedPositions)
unit
- the simple unit supported by this resolution (e.g. TEN)format
- the format how the unit will be shown on the screenstepRate
- the step rate (e.g. "1", "5", "15")supportedPositions
- the position inside the dateline where this resolution can be displayed (top, middle, bottom)public SimpleUnitResolution(SimpleUnit unit, String format, int stepRate)
unit
- the simple unit supported by this resolution (e.g. TEN)format
- the format how the unit will be shown on the screenstepRate
- the step rate (e.g. "1", "5", "15")public String format(Instant instant, ZoneId zoneId)
Resolution
format
in class Resolution<SimpleUnit>
instant
- the time used for the formattingzoneId
- the time zonepublic Instant truncate(Instant temporal, ZoneId zoneId, DayOfWeek firstDayOfWeek)
Resolution
truncate
in class Resolution<SimpleUnit>
temporal
- the time to truncatezoneId
- the time zonefirstDayOfWeek
- the weekday that is considered to be the first
day of the weekpublic Instant increment(Instant instant, ZoneId zoneId)
Resolution
increment
in class Resolution<SimpleUnit>
instant
- the time to incrementzoneId
- the time zonepublic Instant decrement(Instant instant, ZoneId zoneId)
Resolution
decrement
in class Resolution<SimpleUnit>
instant
- the time to incrementzoneId
- the time zonepublic VirtualGrid<SimpleUnit> createGrid()
Resolution
createGrid
in class Resolution<SimpleUnit>
Copyright © 2020 Dirk Lemmermann Software & Consulting. All rights reserved.