ix.util
Class Seq

java.lang.Object
  extended by ix.util.Seq

public abstract class Seq
extends java.lang.Object

Seq defines some convenient methods for use with sequences, where a sequence is an Object[], a Vector, a LList, or an Enumeration. Enumerations are used as a common intermediate form for conversions and are also given some operations of their own.

A Collection can be used as the source of an Enumeration. This gives us a simple, but still open-ended, ability to handle new types.

Needs further modification to better fit Collections and Iterators

See Also:
Collection

Nested Class Summary
static class Seq.IteratorEnumeration
           
 
Method Summary
static void addEnumeration(Collector c, java.util.Enumeration e)
           
static Function1 elementAdder(Collector c)
           
static java.util.Enumeration elements(java.util.Collection c)
           
static java.util.Enumeration elements(LList l)
           
static java.util.Enumeration elements(java.lang.Object[] a)
           
static java.util.Enumeration elements(java.util.Vector v)
           
static java.util.Vector fillVector(java.util.Vector v, java.util.Enumeration e)
           
static java.util.Enumeration filter(java.util.Enumeration e, Predicate1 p)
          Takes an Enumeration e and a Predicate1 p and returns a "wrapper" Enumeration w such that the elements of w are the corresponding elements of e, omitting the elements of e for which p.trueOf returns false.
static void forEach(java.util.Enumeration e, Function1 f)
          Applies a Function1 to each element of an Enumeration and discards the results.
static java.util.Enumeration map(java.util.Enumeration e, Function1 f)
          Takes an Enumeration e and a Function1 f and returns a "wrapper" Enumeration w such that each element of w is the result of calling f on the corresponding element of e.
static java.util.Vector shuffleVector(java.util.Vector v)
           
static java.lang.Object[] toArray(java.util.Enumeration e)
           
static LList toLList(java.util.Enumeration e)
           
static java.util.Vector toVector(java.util.Enumeration e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toVector

public static java.util.Vector toVector(java.util.Enumeration e)

fillVector

public static java.util.Vector fillVector(java.util.Vector v,
                                          java.util.Enumeration e)

toArray

public static java.lang.Object[] toArray(java.util.Enumeration e)

toLList

public static LList toLList(java.util.Enumeration e)

elements

public static java.util.Enumeration elements(java.util.Vector v)

elements

public static java.util.Enumeration elements(LList l)

elements

public static java.util.Enumeration elements(java.lang.Object[] a)

elements

public static java.util.Enumeration elements(java.util.Collection c)

forEach

public static void forEach(java.util.Enumeration e,
                           Function1 f)
Applies a Function1 to each element of an Enumeration and discards the results.


map

public static java.util.Enumeration map(java.util.Enumeration e,
                                        Function1 f)
Takes an Enumeration e and a Function1 f and returns a "wrapper" Enumeration w such that each element of w is the result of calling f on the corresponding element of e.


filter

public static java.util.Enumeration filter(java.util.Enumeration e,
                                           Predicate1 p)
Takes an Enumeration e and a Predicate1 p and returns a "wrapper" Enumeration w such that the elements of w are the corresponding elements of e, omitting the elements of e for which p.trueOf returns false.


addEnumeration

public static void addEnumeration(Collector c,
                                  java.util.Enumeration e)

elementAdder

public static Function1 elementAdder(Collector c)

shuffleVector

public static java.util.Vector shuffleVector(java.util.Vector v)