Class WaitableFloat

    • Constructor Detail

      • WaitableFloat

        public WaitableFloat​(float initialValue)
        Make a new WaitableFloat with the given initial value, and using its own internal lock.
      • WaitableFloat

        public WaitableFloat​(float initialValue,
                             Object lock)
        Make a new WaitableFloat with the given initial value, and using the supplied lock.
    • Method Detail

      • commit

        public boolean commit​(float assumedValue,
                              float newValue)
        Description copied from class: SynchronizedFloat
        Set value to newValue only if it is currently assumedValue.
        Overrides:
        commit in class SynchronizedFloat
        Returns:
        true if successful
      • add

        public float add​(float amount)
        Description copied from class: SynchronizedFloat
        Add amount to value (i.e., set value += amount)
        Overrides:
        add in class SynchronizedFloat
        Returns:
        the new value
      • subtract

        public float subtract​(float amount)
        Description copied from class: SynchronizedFloat
        Subtract amount from value (i.e., set value -= amount)
        Overrides:
        subtract in class SynchronizedFloat
        Returns:
        the new value
      • multiply

        public float multiply​(float factor)
        Description copied from class: SynchronizedFloat
        Multiply value by factor (i.e., set value *= factor)
        Overrides:
        multiply in class SynchronizedFloat
        Returns:
        the new value
      • divide

        public float divide​(float factor)
        Description copied from class: SynchronizedFloat
        Divide value by factor (i.e., set value /= factor)
        Overrides:
        divide in class SynchronizedFloat
        Returns:
        the new value
      • whenNotEqual

        public void whenNotEqual​(float c,
                                 Runnable action)
                          throws InterruptedException
        wait until value not equal to c, then run action if nonnull. The action is run with the synchronization lock held.
        Throws:
        InterruptedException
      • whenLessEqual

        public void whenLessEqual​(float c,
                                  Runnable action)
                           throws InterruptedException
        wait until value less than or equal to c, then run action if nonnull. The action is run with the synchronization lock held.
        Throws:
        InterruptedException
      • whenGreaterEqual

        public void whenGreaterEqual​(float c,
                                     Runnable action)
                              throws InterruptedException
        wait until value greater than or equal to c, then run action if nonnull. The action is run with the synchronization lock held.
        Throws:
        InterruptedException
      • whenGreater

        public void whenGreater​(float c,
                                Runnable action)
                         throws InterruptedException
        wait until value greater than c, then run action if nonnull. The action is run with the synchronization lock held.
        Throws:
        InterruptedException