All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.staccatocommons.defs.function.Function3 Maven / Gradle / Ivy

/**
 *  Copyright (c) 2010-2012, The StaccatoCommons Team
 *
 *  This program 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; version 3 of the License.
 *
 *  This program 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.
 */


package net.sf.staccatocommons.defs.function;

import net.sf.staccatocommons.defs.Applicable;
import net.sf.staccatocommons.defs.Applicable2;
import net.sf.staccatocommons.defs.Applicable3;
import net.sf.staccatocommons.defs.Applicative;
import net.sf.staccatocommons.defs.Delayable3;
import net.sf.staccatocommons.defs.NullSafe;
import net.sf.staccatocommons.defs.partial.NullSafeAware;
import net.sf.staccatocommons.defs.tuple.Tuple3;

/**
 * {@link Function3}s are rich interfaced {@link Applicable3}s - two arguments
 * {@link Delayable3} and {@link NullSafeAware} transformations.
 * 
 * 
 * {@link Function3} can also be partially
 * applied, which means, applying it with less arguments than required,
 * returning, instead of the result of the transformation, a new function that
 * expects the rest of the arguments. Thus, {@link Function3} do also implement
 * {@link Applicable} and {@link Applicable2}
 * 
 * @author flbulgarelli
 * 
 * @param 
 *          function first argument type
 * @param 
 *          function second argument type
 * @param 
 *          function return type
 * 
 */
@Applicative
public interface Function3 extends Applicable3, Applicable2>,
  Applicable>, NullSafeAware>, Delayable3 {

  /**
   * Partially applies the function, passing only its first argument
   */
  Function2 apply(final A arg0);

  /**
   * Partially applies the function, passing only its first and second arguments
   */
  Function apply(final A arg0, final B arg1);

  D apply(A arg0, B arg1, C arg2);

  /**
   * Answers a new function that returns null if any of its arguments is null,
   * or the result of applying this function, otherwise.
   * 
   * @return a new null-safe {@link Function3}
   */
  @NullSafe
  Function3 nullSafe();
  

  /**
   * Uncurries this function,
   *  by returning a {@link Function} that takes a
   * single triple, being its components each of the original function
   * parameters
   * 
   * @return a new {@link Function}
   */
  Function, D> uncurry();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy