/*
 * Copyright (C) 2010 TranceCode Software
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 * 
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
 */
package org.trancecode.parallel;

import com.google.common.base.Predicate;

import java.util.concurrent.Future;

/**
 * {@link Predicate} implementations related to {@link Future}.
 * 
 * @author Herve Quiroz
 */
public final class FuturePredicates
{
    /**
     * @see Future#isCancelled()
     */
    public static <T> Predicate<Future<T>> isCancelled()
    {
        @SuppressWarnings("unchecked")
        final IsCancelledPredicate<T> predicate = (IsCancelledPredicate<T>) IsCancelledPredicate.INSTANCE;
        return predicate;
    }

    private static final class IsCancelledPredicate<T> implements Predicate<Future<T>>
    {
        private static final IsCancelledPredicate<?> INSTANCE = new IsCancelledPredicate<Object>();

        @Override
        public boolean apply(final Future<T> task)
        {
            return task.isCancelled();
        }
    }

    private FuturePredicates()
    {
        // No instantiation
    }
}

@@ -1644,32 +1644,607 @@
        %7D%0A    %7D%0A%0A
+    /**%0A     * @see Future#isDone()%0A     */%0A    public static %3CT%3E Predicate%3CFuture%3CT%3E%3E isDone()%0A    %7B%0A        @SuppressWarnings(%22unchecked%22)%0A        final IsDonePredicate%3CT%3E predicate = (IsDonePredicate%3CT%3E) IsDonePredicate.INSTANCE;%0A        return predicate;%0A    %7D%0A%0A    private static final class IsDonePredicate%3CT%3E implements Predicate%3CFuture%3CT%3E%3E%0A    %7B%0A        private static final IsDonePredicate%3C?%3E INSTANCE = new IsDonePredicate%3CObject%3E();%0A%0A        @Override%0A        public boolean apply(final Future%3CT%3E task)%0A        %7B%0A            return task.isDone();%0A        %7D%0A    %7D%0A%0A
     private Futu

Add FuturePredicates.isDone()