Class Time

  • All Implemented Interfaces:

    
    public final class Time
    
                        
    • Constructor Detail

    • 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 value
        inc - 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 - timeout
        event - event
        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

      • flip

         final static Number flip(Number a, Number b)

        Flip two values at each round. Return b at first.

        Parameters:
        a - first value
        b - 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 - timeout
        event - event
        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

      • 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 first
        condition - whether it is possible to execute continuation
        g - 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 first
        condition - boolean condition
        g - 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 first
        condition - boolean condition
        g - what to execute next
        Returns:

        apply f until condition becomes true in all the devices, apply g next