Class Time
-
- All Implemented Interfaces:
public final class Time
-
-
Method Summary
Modifier and Type Method Description final static Boolean
allTime(Boolean event)
final static Boolean
anyTime(Boolean event)
final static Number
counter(Number start, Number inc)
Counter. final static Number
countTrue(Boolean event)
How many times an event occurred. final static Boolean
falseDuringLast(Number timeout, Boolean event)
final static Boolean
falseDuringLastWithDt(Number timeout, Boolean event, Number dt)
final static Boolean
falseFor(Object time, Boolean event)
final static Boolean
falseForWithDt(Object time, Boolean event, Number dt)
final static Number
flip(Number a, Number b)
Flip two values at each round. final static Object
once(Object f)
Evaluate an expression once, then store and return the result thereafter final static Boolean
trueDuringLast(Number timeout, Boolean event)
final static Boolean
trueDuringLastWithDt(Number timeout, Boolean event, Number dt)
final static Boolean
trueFor(Object time, Boolean event)
final static Boolean
trueForWithDt(Object time, Boolean event, Number dt)
final static <T extends Any, U extends Any> Object
sequence(Function1<Unit, T> f, Function1<T, Boolean> condition, Function1<T, U> g)
final static <T extends Any, U extends Any> Object
sequenceIfAny(Function1<Unit, T> f, Boolean condition, Function1<T, U> g)
final static <T extends Any, U extends Any> Object
sequenceIfAll(Function1<Unit, T> f, Boolean condition, Function1<T, U> g)
final static Number
timeSinceStart()
Time flow. final static Number
timeSinceStartWithDt(Number dt)
Time flow. -
-
Method Detail
-
allTime
final static Boolean allTime(Boolean event)
- Parameters:
event
- event- Returns:
true if the event is always verified
-
anyTime
final static Boolean anyTime(Boolean event)
- Parameters:
event
- event- Returns:
whether the event has occurred at least once
-
counter
final static Number counter(Number start, Number inc)
Counter.
- Parameters:
start
- counter initial valueinc
- how much to increase the counter- Returns:
current status of the counter
-
countTrue
final static Number countTrue(Boolean event)
How many times an event occurred.
- Parameters:
event
- event to be monitored- Returns:
how many times an event occurred
-
falseDuringLast
final static Boolean falseDuringLast(Number timeout, Boolean event)
- Parameters:
timeout
- timeoutevent
- event- Returns:
true if the event did not occurred within last time period
-
falseDuringLastWithDt
final static Boolean falseDuringLastWithDt(Number timeout, Boolean event, Number dt)
- Parameters:
timeout
- timeoutevent
- eventdt
- dt- Returns:
true if the event did not occurred within last time period
-
falseFor
final static Boolean falseFor(Object time, Boolean event)
- Parameters:
event
- event- Returns:
true if a false condition has persisted for time
-
falseForWithDt
final static Boolean falseForWithDt(Object time, Boolean event, Number dt)
- Parameters:
event
- eventdt
- dt- Returns:
true if a false condition has persisted for time
-
flip
final static Number flip(Number a, Number b)
Flip two values at each round. Return b at first.
- Parameters:
a
- first valueb
- second value- Returns:
(ba)+ sequence of values
-
once
final static Object once(Object f)
Evaluate an expression once, then store and return the result thereafter
- Parameters:
f
- run once and then its result is stored
-
trueDuringLast
final static Boolean trueDuringLast(Number timeout, Boolean event)
- Parameters:
timeout
- timeoutevent
- event- Returns:
true if the event occurred within last time period
-
trueDuringLastWithDt
final static Boolean trueDuringLastWithDt(Number timeout, Boolean event, Number dt)
- Parameters:
timeout
- timeoutevent
- eventdt
- dt- Returns:
true if the event occurred within last time period
-
trueFor
final static Boolean trueFor(Object time, Boolean event)
- Parameters:
event
- event- Returns:
true if a true condition has persisted for time
-
trueForWithDt
final static Boolean trueForWithDt(Object time, Boolean event, Number dt)
- Parameters:
event
- eventdt
- dt- Returns:
true if a true condition has persisted for time
-
sequence
final static <T extends Any, U extends Any> Object sequence(Function1<Unit, T> f, Function1<T, Boolean> condition, Function1<T, U> g)
- Parameters:
f
- what to execute firstcondition
- whether it is possible to execute continuationg
- what to execute next- Returns:
apply f until condition becomes true, apply g next
-
sequenceIfAny
final static <T extends Any, U extends Any> Object sequenceIfAny(Function1<Unit, T> f, Boolean condition, Function1<T, U> g)
- Parameters:
f
- what to execute firstcondition
- boolean conditiong
- what to execute next- Returns:
apply f until condition becomes true in any device, apply g next
-
sequenceIfAll
final static <T extends Any, U extends Any> Object sequenceIfAll(Function1<Unit, T> f, Boolean condition, Function1<T, U> g)
- Parameters:
f
- what to execute firstcondition
- boolean conditiong
- what to execute next- Returns:
apply f until condition becomes true in all the devices, apply g next
-
timeSinceStart
final static Number timeSinceStart()
Time flow.
- Returns:
time since start
-
timeSinceStartWithDt
final static Number timeSinceStartWithDt(Number dt)
Time flow.
- Parameters:
dt
- increase the counter of dt- Returns:
time since start
-
-
-
-