org.jtiger.framework
Class SequenceFactory

java.lang.Object
  extended by org.jtiger.framework.SequenceFactory

public final class SequenceFactory
extends Object

Returns instances of Sequence such that state cannot be modified.

Version:
2.1
Build Number 0376
Build Time 2006-07-28 01:50.16.218
Author:
Tony Morris
See Also:
Sequence

Method Summary
static
<E> Sequence<E>
newConstantSequence(E constant, int length)
          Returns a new instance of Sequence that is backed by the given constant for the given length.
static
<E> Sequence<E>
newSequence(E... a)
          Returns a new instance of Sequence that is backed by the given arguments.
static
<E> Sequence<E>
newSequence(List<E> l)
          Returns a new instance of Sequence that is backed by the given List.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newSequence

public static <E> Sequence<E> newSequence(E... a)
                               throws NullPointerException
Returns a new instance of Sequence that is backed by the given arguments.

Parameters:
a - The array that backs the returned Sequence.
Returns:
A new instance of Sequence that is backed by the given arguments.
Throws:
NullPointerException - If a is null.

newSequence

public static <E> Sequence<E> newSequence(List<E> l)
                               throws NullPointerException
Returns a new instance of Sequence that is backed by the given List.

Parameters:
l - The List that backs the returned Sequence.
Returns:
A new instance of Sequence that is backed by the given List.
Throws:
NullPointerException - If l is null.

newConstantSequence

public static <E> Sequence<E> newConstantSequence(E constant,
                                                  int length)
                                       throws IllegalArgumentException
Returns a new instance of Sequence that is backed by the given constant for the given length.

Parameters:
constant - The constant that backs the returned Sequence.
length - The length of the constant that backs the returned Sequence.
Returns:
A new instance of Sequence that is backed by the given constant.
Throws:
IllegalArgumentException - If length is less than 1.