package org.matheclipse.core.generic;

import org.matheclipse.core.generic.interfaces.BiFunction;

import com.google.common.base.Function;

/**
 * A function object that takes two arguments and returns a result. The two
 * arguments are both of type T and the result is also of type
 * T
 */
public abstract class BinaryFunctorImpl implements BiFunction {
	/**
	 * Executes the function and returns the result.
	 * 
	 * @throws FunctionException
	 */
	public abstract T apply(T firstArg, T secondArg);

	public Function bind2(final T p_param2) {
		final BinaryFunctorImpl f2 = this;

		return new Function() {
			public T apply(T p_param1) {
				return f2.apply(p_param1, p_param2);
			}
		};
	}
}

 

Ads help maintain this website.