com.metamatrix.common.buffer
Class TupleBatch

java.lang.Object
  extended by com.metamatrix.common.buffer.TupleBatch
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class TupleBatch
extends java.lang.Object
implements java.io.Externalizable

Represents a set of indexed tuples. The beginning row is the first row contained in this batch; if it equals "1" then it is the first row of the tuple source, otherwise this is a batch of intermediate tuples. The ending row is the last row contained in this tuple batch; it is equal to the beginning row plus the number of rows contained in this batch, minus one. This object is immutable and Serializable;

See Also:
Serialized Form

Field Summary
static long UNKNOWN_SIZE
           
 
Constructor Summary
TupleBatch()
          Required to honor Externalizable contract
TupleBatch(int beginRow, java.util.List listOfTupleLists)
          Constructor
TupleBatch(int beginRow, java.util.List[] tuples)
          Constructor
 
Method Summary
 java.util.List[] getAllTuples()
          Get all tuples
 int getBeginRow()
          Return the number of the first row of the tuple source that is contained in this batch (one-based).
 int getEndRow()
          Return number of the last row of the tuple source that is contained in this batch (one-based).
 int getRowCount()
          Return the number of rows contained in this tuple batch
 long getSize()
          Get the size of this batch - may be constant indicating unknown.
 boolean getTerminationFlag()
          Check whether this batch is the last in a series of batches.
 java.util.List getTuple(int rowIndex)
          Return the tuple at the given index (one-based).
 void readExternal(java.io.ObjectInput in)
           
 void setDataTypes(java.lang.String[] types)
           
 void setSize(long size)
          Set the size of this batch.
 void setTerminationFlag(boolean terminationFlag)
          Set whether this batch is the last in a series of batches.
 java.lang.String toString()
          Return a String describing this object
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN_SIZE

public static final long UNKNOWN_SIZE
See Also:
Constant Field Values
Constructor Detail

TupleBatch

public TupleBatch()
Required to honor Externalizable contract


TupleBatch

public TupleBatch(int beginRow,
                  java.util.List[] tuples)
Constructor

Parameters:
beginRow - indicates the row of the tuple source which is the first row contained in this batch
tuples - array of List objects, each of which is a single tuple

TupleBatch

public TupleBatch(int beginRow,
                  java.util.List listOfTupleLists)
Constructor

Parameters:
beginRow - indicates the row of the tuple source which is the first row contained in this batch
listOfTupleLists - List containing List objects, each of which is a single tuple
Method Detail

getBeginRow

public int getBeginRow()
Return the number of the first row of the tuple source that is contained in this batch (one-based).

Returns:
the first row contained in this tuple batch

getEndRow

public int getEndRow()
Return number of the last row of the tuple source that is contained in this batch (one-based).

Returns:
the last row contained in this tuple batch

getRowCount

public int getRowCount()
Return the number of rows contained in this tuple batch

Returns:
the number of rows contained in this tuple batch

getTuple

public java.util.List getTuple(int rowIndex)
Return the tuple at the given index (one-based).

Returns:
the tuple at the given index

getAllTuples

public java.util.List[] getAllTuples()
Get all tuples

Returns:
All tuples

getTerminationFlag

public boolean getTerminationFlag()
Check whether this batch is the last in a series of batches.

Returns:
True if this batch is last

setTerminationFlag

public void setTerminationFlag(boolean terminationFlag)
Set whether this batch is the last in a series of batches.

Parameters:
terminationFlag - True if last

getSize

public long getSize()
Get the size of this batch - may be constant indicating unknown.

Returns:
Size of batch in bytes or UNKNOWN_SIZE

setSize

public void setSize(long size)
Set the size of this batch.

Parameters:
size - Size in bytes or UNKNOWN_SIZE

setDataTypes

public void setDataTypes(java.lang.String[] types)

toString

public java.lang.String toString()
Return a String describing this object

Overrides:
toString in class java.lang.Object
Parameters:
String - representation of this TupleBatch

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException


Copyright © 2009. All Rights Reserved.