-
- All Implemented Interfaces:
public final class Time
-
-
Method Summary
Modifier and Type Method Description final static <T extends Any> T
applyWhile(Boolean event, Function1<Unit, T> f, T null)
Apply a function while condition is true. final static Number
countDown(Number length)
final static Number
countDownWithDecay(Number length, Number dt)
final static Boolean
cyclicTimer(Number length)
Cyclic timer. final static Boolean
cyclicTimerWithDecay(Number length, Number decay)
Cyclic timer. final static <T extends Any> T
cyclicFunction(Number length, Function1<Unit, T> f, T null)
Periodically invoke a function. final static <T extends Any> T
cyclicFunctionWithDecay(Number length, Number decay, Function1<Unit, T> f, T null)
Periodically invoke a function. final static Number
delta(Number signal)
final static <T extends Any> <ERROR CLASS>
evaporation(Number length, T info, Number decay)
Evaporation pattern. final static Number
exponentialBackoffFilter(Number signal, Number a)
Exponential back-off filter. final static Boolean
falseAfterTime(Number timeout)
final static Boolean
falseAfterTimeWithDt(Number timeout, Number dt)
final static Boolean
isFallingEdge(Boolean signal)
final static Boolean
isRecentEvent(Boolean event, Number timeout)
final static Boolean
isRisingEdge(Boolean signal)
final static <T extends Any> Boolean
isSignalStable(T signal, Number time)
final static <T extends Any> Boolean
isSignalStableWithDt(T signal, Number time, Number dt)
final static <T extends Any> Boolean
isValueChanged(T signal)
final static <T extends Any> T
limitedMemory(T value, T null, Number timeout, Number dt)
Hold value until a specified timeout. final static Unit
T(Object initial, Object zero, Object decay)
final static Boolean
trueAfterTime(Number timeout)
final static Boolean
trueAfterTimeWithDt(Number timeout, Number dt)
final static Boolean
wait(Number timeout)
final static Boolean
waitWithDecay(Number timeout, Number dt)
final static <T extends Any> T
waitAndApply(Number timeout, Function1<Unit, T> f, T null)
-
-
Method Detail
-
applyWhile
final static <T extends Any> T applyWhile(Boolean event, Function1<Unit, T> f, T null)
Apply a function while condition is true.
- Parameters:
event
- eventf
- function to be appliednull
- null value
-
countDownWithDecay
final static Number countDownWithDecay(Number length, Number dt)
- Parameters:
length
- count down lengthdt
- decay
-
cyclicTimer
final static Boolean cyclicTimer(Number length)
Cyclic timer.
- Parameters:
length
- timeout
-
cyclicTimerWithDecay
final static Boolean cyclicTimerWithDecay(Number length, Number decay)
Cyclic timer.
- Parameters:
length
- timeoutdecay
- decay rate
-
cyclicFunction
final static <T extends Any> T cyclicFunction(Number length, Function1<Unit, T> f, T null)
Periodically invoke a function.
- Parameters:
length
- timeoutf
- function to be invokednull
- default value
-
cyclicFunctionWithDecay
final static <T extends Any> T cyclicFunctionWithDecay(Number length, Number decay, Function1<Unit, T> f, T null)
Periodically invoke a function.
- Parameters:
length
- timeoutdecay
- decay ratef
- function to be invokednull
- default value
-
evaporation
final static <T extends Any> <ERROR CLASS> evaporation(Number length, T info, Number decay)
Evaporation pattern.
- Parameters:
length
- durationinfo
- informationdecay
- decay rate
-
exponentialBackoffFilter
final static Number exponentialBackoffFilter(Number signal, Number a)
Exponential back-off filter.
- Parameters:
signal
- signal to be filtereda
- alpha value
-
falseAfterTime
final static Boolean falseAfterTime(Number timeout)
- Parameters:
timeout
- timeout
-
falseAfterTimeWithDt
final static Boolean falseAfterTimeWithDt(Number timeout, Number dt)
- Parameters:
timeout
- timeoutdt
- dt
-
isFallingEdge
final static Boolean isFallingEdge(Boolean signal)
- Parameters:
signal
- binary signal to be monitored
-
isRecentEvent
final static Boolean isRecentEvent(Boolean event, Number timeout)
- Parameters:
event
- eventtimeout
- timeout
-
isRisingEdge
final static Boolean isRisingEdge(Boolean signal)
- Parameters:
signal
- binary signal to be monitored
-
isSignalStable
final static <T extends Any> Boolean isSignalStable(T signal, Number time)
- Parameters:
signal
- signal to be monitoredtime
- consider the signal stable after this time
-
isSignalStableWithDt
final static <T extends Any> Boolean isSignalStableWithDt(T signal, Number time, Number dt)
- Parameters:
signal
- signal to be monitoredtime
- consider the signal stable after this timedt
- dt
-
isValueChanged
final static <T extends Any> Boolean isValueChanged(T signal)
- Parameters:
signal
- value to be monitored
-
limitedMemory
final static <T extends Any> T limitedMemory(T value, T null, Number timeout, Number dt)
Hold value until a specified timeout.
TODO: reconsider this function. When do we trigger the recording?
- Parameters:
value
- value to be storednull
- default valuetimeout
- hold the value for this amount of timedt
- increase the time of this value
-
trueAfterTime
final static Boolean trueAfterTime(Number timeout)
- Parameters:
timeout
- timeout
-
trueAfterTimeWithDt
final static Boolean trueAfterTimeWithDt(Number timeout, Number dt)
- Parameters:
timeout
- timeoutdt
- dt
-
waitWithDecay
final static Boolean waitWithDecay(Number timeout, Number dt)
- Parameters:
timeout
- count down lengthdt
- decay
-
waitAndApply
final static <T extends Any> T waitAndApply(Number timeout, Function1<Unit, T> f, T null)
- Parameters:
timeout
- timeutf
- function to be appliednull
- null value
-
-
-
-