Constructor and Description |
---|
MutableClock()
|
MutableClock(Instant instant)
Initializes a with given instant and
ZoneId.systemDefault() and 1 second changeAmount . |
MutableClock(Instant instant,
ZoneId zone)
Initializes a with 1 second
changeAmount and given parameters. |
MutableClock(Instant instant,
ZoneId zone,
TemporalAmount changeAmount) |
MutableClock(ZonedDateTime zonedDateTime)
Initializes a with instant and zone from
ZonedDateTime and 1 second changeAmount . |
MutableClock(ZoneId zone)
Initializes a with
Instant.now() and given zone and 1 second changeAmount . |
Modifier and Type | Method and Description |
---|---|
MutableClock |
adjust(TemporalAdjuster adjuster)
Applies the given
TemporalAdjuster to the internal time. |
ZoneId |
getZone() |
Instant |
instant() |
MutableClock |
minus(TemporalAmount amount)
Subtracts the given
TemporalAmount from the internal time. |
MutableClock |
modify(BiFunction<Instant,ZoneId,Instant> modification)
Sets the internal time based on the result of the modification.
|
MutableClock |
next()
Adds
changeAmount to internal time. |
MutableClock |
plus(TemporalAmount amount)
Adds the given
TemporalAmount to the internal time. |
MutableClock |
previous()
Subtracts
changeAmount from internal time. |
void |
setChangeAmount(TemporalAmount changeAmount) |
void |
setInstant(Instant instant) |
String |
toString() |
MutableClock |
withZone(ZoneId zone) |
equals, fixed, hashCode, millis, offset, system, systemDefaultZone, systemUTC, tick, tickMinutes, tickSeconds
public MutableClock()
public MutableClock(Instant instant)
ZoneId.systemDefault()
and 1 second changeAmount
.instant
- to usepublic MutableClock(ZoneId zone)
Instant.now()
and given zone and 1 second changeAmount
.zone
- to usepublic MutableClock(Instant instant, ZoneId zone)
changeAmount
and given parameters.instant
- to usezone
- to usepublic MutableClock(Instant instant, ZoneId zone, TemporalAmount changeAmount)
public MutableClock(ZonedDateTime zonedDateTime)
ZonedDateTime
and 1 second changeAmount
.zonedDateTime
- to use for instant and zone informationpublic MutableClock withZone(ZoneId zone)
public void setChangeAmount(TemporalAmount changeAmount)
public void setInstant(Instant instant)
public MutableClock modify(BiFunction<Instant,ZoneId,Instant> modification)
modification
- a function to produce a new Instantpublic MutableClock plus(TemporalAmount amount)
TemporalAmount
to the internal time.amount
- to addpublic MutableClock minus(TemporalAmount amount)
TemporalAmount
from the internal time.amount
- to subtractpublic MutableClock adjust(TemporalAdjuster adjuster)
TemporalAdjuster
to the internal time.adjuster
- the adjuster to use,public MutableClock next()
changeAmount
to internal time.public MutableClock previous()
changeAmount
from internal time.