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

net.sf.staccatocommons.lang.function.AbstractDelayable3 Maven / Gradle / Ivy

/*
 Copyright (c) 2011, The Staccato-Commons 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.lang.function;

import net.sf.staccatocommons.defs.Applicable3;
import net.sf.staccatocommons.defs.Delayable3;
import net.sf.staccatocommons.defs.Thunk;
import net.sf.staccatocommons.restrictions.check.NonNull;

/**
 * @author flbulgarelli
 * 
 * @param 
 * @param 
 * @param 
 * @param 
 */
public abstract class AbstractDelayable3 implements Applicable3, Delayable3 {

  /**
   * Creates a new {@link AbstractDelayable3}
   */
  public AbstractDelayable3() {
    super();
  }

  @Override
  @NonNull
  public Thunk delayed(final A arg0, final B arg1, final C arg2) {
    return new Thunk() {
      public D value() {
        return apply(arg0, arg1, arg2);
      }
    };
  }

  @Override
  @NonNull
  public Thunk delayedValue(@NonNull final Thunk thunk0, @NonNull final Thunk thunk1,
    @NonNull final Thunk thunk2) {
    return new Thunk() {
      public D value() {
        return apply(thunk0.value(), thunk1.value(), thunk2.value());
      }
    };
  }

}