net.sf.jga.parser
Class Multiplex

java.lang.Object
  extended by net.sf.jga.fn.Functor<java.lang.Object[]>
      extended by net.sf.jga.parser.Multiplex
All Implemented Interfaces:
java.io.Serializable, Visitable

public class Multiplex
extends Functor<java.lang.Object[]>

Routes an array of values to a given array of unary functions, returning an array containing the results. If the number of values passed to evaluation is less than the number of functions, then nulls are returned in the unused positions. If the number of values passed to evaluation is greated than the number of functions, the excess arguments are ignored.

See Also:
Serialized Form

Constructor Summary
Multiplex(UnaryFunctor[] branches)
           
 
Method Summary
 java.lang.Object[] eval(java.lang.Object... args)
          Returns an array containing the results obtained by passing the args to the array of functions given at construction.
 
Methods inherited from class net.sf.jga.fn.Functor
accept, bind0th, bindNth, composeNth, composeNth, generateNth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Multiplex

public Multiplex(UnaryFunctor[] branches)
Method Detail

eval

public java.lang.Object[] eval(java.lang.Object... args)
Returns an array containing the results obtained by passing the args to the array of functions given at construction.

Specified by:
eval in class Functor<java.lang.Object[]>
Throws:
java.lang.ClassCastException - if one of the arguments is not of the correct type for the corresponding function.


Copyright © 2002-2006 David A. Hall. All Rights Reserved.