/**
 * 
 */
package com.hammurapi.reasoning.impl;

import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

/**
 * Future which already happened.
 * @author Pavel Vlasov
 *
 * @param <T>
 */
class Present<T> implements Future<T> {
	
	private T obj;

	Present(T obj) {
		this.obj = obj;
	}

	@Override
	public boolean cancel(boolean mayInterruptIfRunning) {
		return false;
	}

	@Override
	public T get() {
		return obj;
	}

	@Override
	public T get(long timeout, TimeUnit unit) {
		return obj;
	}

	@Override
	public boolean isCancelled() {
		return false;
	}

	@Override
	public boolean isDone() {
		return true;
	}
	
}