edu.rice.cs.cunit.util
Class ILambda.Nary.BindK<R,P>

java.lang.Object
  extended by edu.rice.cs.cunit.util.ILambda.Nary.BindK<R,P>
All Implemented Interfaces:
ILambda.Nary<R,P>
Enclosing interface:
ILambda.Nary<R,P>

public static class ILambda.Nary.BindK<R,P>
extends java.lang.Object
implements ILambda.Nary<R,P>

(N-K)-ary decorator for an N-ary lambda that binds constants to K of its parameters.


Nested Class Summary
 
Nested classes/interfaces inherited from interface edu.rice.cs.cunit.util.ILambda.Nary
ILambda.Nary.BinaryAdaptor<R,P>, ILambda.Nary.Bind<R,P>, ILambda.Nary.BindK<R,P>, ILambda.Nary.Max<T extends java.lang.Comparable<T>>, ILambda.Nary.Min<T extends java.lang.Comparable<T>>, ILambda.Nary.TernaryAdaptor<R,P>, ILambda.Nary.UnaryAdaptor<R,P>
 
Field Summary
private  P[] _constants
          Array with constant arguments.
private  ILambda.Nary<R,P> _decoree
          The N-ary lambda.
private  int[] _indices
          Array with indices of the constant parameters.
 
Constructor Summary
ILambda.Nary.BindK(ILambda.Nary<R,P> decoree, int[] indices, P... constants)
          Creates a new (N-K)-ary decorator for an N-ary lambda, binding constants to K of its parameters.
 
Method Summary
 R apply(P... param)
          Apply the (N-K)-ary decorator, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_indices

private int[] _indices
Array with indices of the constant parameters.


_constants

private P[] _constants
Array with constant arguments.


_decoree

private ILambda.Nary<R,P> _decoree
The N-ary lambda.

Constructor Detail

ILambda.Nary.BindK

public ILambda.Nary.BindK(ILambda.Nary<R,P> decoree,
                          int[] indices,
                          P... constants)
Creates a new (N-K)-ary decorator for an N-ary lambda, binding constants to K of its parameters.

Parameters:
decoree - N-ary lambda
indices - array of K indices in strictly ascending order, each 0 <= index < N
constants - K constant arguments
Throws:
java.lang.IllegalArgumentException - if indices.length != constants.length
Method Detail

apply

public R apply(P... param)
Apply the (N-K)-ary decorator, i.e. apply the N-ary lambda with the K constants spliced into the given (N-K) arguments.

Specified by:
apply in interface ILambda.Nary<R,P>
Parameters:
param - (N-K) arguments
Returns:
return value of the N-ary lambda