net.sf.jga.fn.adaptor
Class BindNth<R>
java.lang.Object
net.sf.jga.fn.Functor<R>
net.sf.jga.fn.adaptor.BindNth<R>
- All Implemented Interfaces:
- java.io.Serializable, Visitable
public class BindNth<R>
- extends Functor<R>
Functor that binds values into the argument list of a nested functor at
an arbtirary location.
Copyright © 2009 David A. Hall
- Author:
- David A. Hall
- See Also:
- Serialized Form
Nested Class Summary |
static interface |
BindNth.Visitor
x
Interface for classes that may interpret an BindNth functor. |
Constructor Summary |
BindNth(Functor<R> fn,
int idx,
java.lang.Object binding0,
java.lang.Object... bindings)
|
Method Summary |
void |
accept(Visitor v)
Calls the Visitor's visit(BindNth) method, if it
implements the nested Visitor interface. |
R |
eval(java.lang.Object... args)
Returns the results of the functor, binding the constant values given at construction
to the arguments starting with the given index. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
BindNth
public BindNth(Functor<R> fn,
int idx,
java.lang.Object binding0,
java.lang.Object... bindings)
eval
public R eval(java.lang.Object... args)
- Returns the results of the functor, binding the constant values given at construction
to the arguments starting with the given index.
- Specified by:
eval
in class Functor<R>
- Returns:
- fn.eval(args[0], ..., args[i - 1], bindings[0], ..., bindings[bindings.len - 1], args[i], ...)
- Throws:
java.lang.ArrayIndexOutOfBoundsException
- if the length of the args array is less than the
starting index given at construction.
accept
public void accept(Visitor v)
- Calls the Visitor's
visit(BindNth)
method, if it
implements the nested Visitor interface.
- Specified by:
accept
in interface Visitable
- Overrides:
accept
in class Functor<R>
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright © 2002-2006 David A. Hall. All Rights Reserved.