package org.studentrobotics.ide.checkout;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

public class FutureValue<T> {
	private T mValue = null;
	private CountDownLatch mLatch = new CountDownLatch(1);

	public T get() throws InterruptedException {
		mLatch.await();
		return mValue;
	}

	public T get(long timeout) throws InterruptedException {
		if (!mLatch.await(timeout, TimeUnit.SECONDS))
			return null;
		return mValue;
	}

	public void set(T value) {
		mValue = value;
		mLatch.countDown();
	}
}

@@ -123,205 +123,702 @@
 t;%0A%0A
-public class FutureValue%3CT%3E %7B%0A%09private T mValue = null;%0A%09private CountDownLatch mLatch = new CountDownLatch(1);%0A%0A%09public T get() throws InterruptedException %7B%0A%09%09mLatch.await();%0A%09%09return mValue;%0A%09%7D%0A
+/**%0A * implements a simple way of getting a value from async computation%0A * @author Sam Phippen %3Csamphippen@googlemail.com%3E%0A *%0A * @param %3CT%3E the type of object being waited on%0A */%0Apublic class FutureValue%3CT%3E %7B%0A%09private T mValue = null;%0A%09private CountDownLatch mLatch = new CountDownLatch(1);%0A%0A%09/**%0A%09 * gets the value of this future value, blocks potentially forever%0A%09 * @return%0A%09 * @throws InterruptedException%0A%09 */%0A%09public T get() throws InterruptedException %7B%0A%09%09mLatch.await();%0A%09%09return mValue;%0A%09%7D%0A%0A%09/**%0A%09 * gets the value of this future value, blocks for timeout%0A%09 * @param timeout how long to wait for%0A%09 * @return null if timed out, the value otherwise%0A%09 * @throws InterruptedException%0A%09 */
 %0A%09pu

add some docstrings to futurevalue