org.pf.util
Class Countdown

java.lang.Object
  extended by org.pf.util.Countdown

public class Countdown
extends java.lang.Object

Supports loops with a countdown of a defined time.

Version:
1.0
Author:
M.Duchrow

Method Summary
static void whileFalse(ICondition condition, long millis)
          Runs an empty loop until either the contidion is true or the specified time in milliseconds is over.
static void whileTrue(ICondition condition, long millis)
          Runs an empty loop until either the contidion is false or the specified time in milliseconds is over (more or less).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

whileTrue

public static void whileTrue(ICondition condition,
                             long millis)
Runs an empty loop until either the contidion is false or the specified time in milliseconds is over (more or less). That particularly makes sense if the condition gets influenced by a different thread. Therefore this thread sleeps one millisecond per loop iteration to allow other threads to do something.

Parameters:
condition - A condition that is used to continue (true) or finish (false) the loop
millis - The time in milliseconds after which the loop gets terminated independent of the condition

whileFalse

public static void whileFalse(ICondition condition,
                              long millis)
Runs an empty loop until either the contidion is true or the specified time in milliseconds is over. That particularly makes sense if the condition gets influenced by a different thread. Therefore this thread sleeps one millisecond per loop iteration to allow other threads to do something.

Parameters:
condition - A condition that is used to continue (false) or finish (true) the loop
millis - The time in milliseconds after which the loop gets terminated independent of the condition