org.teiid.common.buffer
Class TupleBatch

java.lang.Object
  extended by org.teiid.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

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
 boolean containsRow(int row)
           
 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
 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).
 java.util.List<java.util.List<?>> getTuples()
           
 void preserveTypes()
           
 void readExternal(java.io.ObjectInput in)
           
 void setDataTypes(java.lang.String[] types)
           
 void setRowOffset(int rowOffset)
           
 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
 

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

getTuples

public java.util.List<java.util.List<?>> getTuples()

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

setDataTypes

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

containsRow

public boolean containsRow(int row)

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

setRowOffset

public void setRowOffset(int rowOffset)

preserveTypes

public void preserveTypes()


Copyright © 2010. All Rights Reserved.