/*
 * Copyright (c) 2009 JSCAPE
 * 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * JSCAPE. ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with JSCAPE.
 *
 */

package com.jscape.util.functor.adapters;

import com.jscape.util.functor.BinaryFunction;
import com.jscape.util.functor.BinaryPredicate;

/**
 * @author Alex Usun
 */
public class BinaryFunctionPredicate<F, S>
        extends BinaryPredicate<F, S> {

    private BinaryFunction<? super F, ? super S, Boolean> base;

    /**
     * @param base base
     * @param <F>
     * @param <S>
     *
     * @return
     */
    public static <F, S> BinaryPredicate<F, S> adapt(BinaryFunction<? super F, ? super S, Boolean> base) {
        return new BinaryFunctionPredicate<F, S>(base);
    }

    /**
     * @param base base
     */
    public BinaryFunctionPredicate(BinaryFunction<? super F, ? super S, Boolean> base) {
        this.base = base;
    }

    /**
     * @param first  first
     * @param second second
     *
     * @return boolean value
     */
    public boolean evaluate(F first, S second) {
        return this.base.evaluate(first, second);
    }

}