org.egothor.merger
Class ConcatSeq<T>

java.lang.Object
  extended by org.egothor.merger.ConcatSeq<T>
All Implemented Interfaces:
Sequence<T>, SequenceWithClose<T>

public class ConcatSeq<T>
extends java.lang.Object
implements SequenceWithClose<T>

The ConcatSeq object reads an input set of sequences one by one and this way it produces this final sequence. In short, it is an sequence of sequences.

Author:
Leo Galambos

Field Summary
 int active
          The number of Sequences that have been added so far.
 int delta
          Zero means - no growing.
 Sequence<T>[] enums
          The Sequences that will be concatenated.
 int max_size
          The maximum size of this object.
 int size
          The size of this object.
 
Constructor Summary
ConcatSeq(int initInputs)
          Constructor for the ConcatSeq object.
ConcatSeq(int initInputs, int delta)
          Constructor for the ConcatEnums object
 
Method Summary
 void add(Sequence<T> e)
          Add the given Sequence to this object if the capacity has not been reached..
 void close()
          Invalidates this sequence, releases all resources etc.
 void kickOff(Sequence<T> e)
          The input Sequence e is exhausted, and it is just after this concatenator has removed/unlinked it from inner structures.
 T next()
          Return the next Sequence in this collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enums

public Sequence<T>[] enums
The Sequences that will be concatenated.


max_size

public int max_size
The maximum size of this object.


size

public int size
The size of this object.


active

public int active
The number of Sequences that have been added so far.


delta

public int delta
Zero means - no growing.

Constructor Detail

ConcatSeq

public ConcatSeq(int initInputs)
Constructor for the ConcatSeq object.

Parameters:
initInputs - Description of the Parameter

ConcatSeq

public ConcatSeq(int initInputs,
                 int delta)
Constructor for the ConcatEnums object

Parameters:
initInputs - Description of the Parameter
delta - Description of the Parameter
Method Detail

add

public void add(Sequence<T> e)
Add the given Sequence to this object if the capacity has not been reached..

Parameters:
e - the Sequence to add

kickOff

public void kickOff(Sequence<T> e)
The input Sequence e is exhausted, and it is just after this concatenator has removed/unlinked it from inner structures. Now it is requested to die, so it would kick off somehow. For instance, if it is a stream, it would be closed when it does not do it automatically. You can also peek at active variable that stores the slot that is being cleaned out. By default, it closes the sequence iff it is a SequenceWithClose.

Parameters:
e - the Sequence

next

public T next()
Return the next Sequence in this collection.

Specified by:
next in interface Sequence<T>
Returns:
the next Sequence

close

public void close()
Description copied from interface: SequenceWithClose
Invalidates this sequence, releases all resources etc.

Specified by:
close in interface SequenceWithClose<T>