org.knime.core.data.collection
Class BlobSupportDataCellList

java.lang.Object
  extended by org.knime.core.data.collection.BlobSupportDataCellList
All Implemented Interfaces:
Iterable<DataCell>

public class BlobSupportDataCellList
extends Object
implements Iterable<DataCell>

A list of DataCell objects, which special treatment for BlobDataCell. The implementation will keep blobs in special BlobWrapperDataCell in order to allow for a possible garbage collection (and deserializing when a blob is accessed.)

Author:
Bernd Wiswedel, University of Konstanz

Constructor Summary
protected BlobSupportDataCellList(Collection<? extends DataCell> coll)
          Creates new instance based on a collection of data cells.
 
Method Summary
 boolean containsBlobWrapperCells()
           
static BlobSupportDataCellList create(Collection<? extends DataCell> coll)
          Factory method to create a list based on a collection.
static BlobSupportDataCellList create(DataRow row, int[] cols)
          Create new list based on selected cell from a DataRow.
static BlobSupportDataCellList deserialize(DataCellDataInput input)
          Static deserializer for a list.
 boolean equals(Object obj)
          
 DataCell get(int index)
          Returns the element at the specified position of the list.
 DataType getElementType()
           
 DataCell getWithBlobSupport(int index)
          Returns the element at the specified position of the list.
 int hashCode()
          
 Iterator<DataCell> iterator()
          
 void serialize(DataCellDataOutput output)
          Write this object to an output.
 int size()
           
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BlobSupportDataCellList

protected BlobSupportDataCellList(Collection<? extends DataCell> coll)
Creates new instance based on a collection of data cells.

Parameters:
coll - The underlying collection (will be copied). BlobDataCell in this collection will be handled with care.
Method Detail

containsBlobWrapperCells

public final boolean containsBlobWrapperCells()
Returns:
the containsBlobs

get

public DataCell get(int index)
Returns the element at the specified position of the list. If it is a blob wrapper cell, it is unwrapped and the contained data cell is returned.

Parameters:
index - the index of the element to return
Returns:
the element at the specified position.
Throws:
IndexOutOfBoundsException - if the index is larger than the list is long

getWithBlobSupport

public DataCell getWithBlobSupport(int index)
Returns the element at the specified position of the list. If the element is a blob wrapper cell the wrapper will be returned (and not unwrapped).

Parameters:
index - the index of the element to return
Returns:
the element at the specified position.
Throws:
IndexOutOfBoundsException - if the index is larger than the list is long

iterator

public Iterator<DataCell> iterator()

Specified by:
iterator in interface Iterable<DataCell>

getElementType

public DataType getElementType()
Returns:
the elementType

size

public int size()
Returns:
Size of the list.

toString

public String toString()

Overrides:
toString in class Object

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

serialize

public void serialize(DataCellDataOutput output)
               throws IOException
Write this object to an output.

Parameters:
output - To write to.
Throws:
IOException - If that fails.

deserialize

public static BlobSupportDataCellList deserialize(DataCellDataInput input)
                                           throws IOException
Static deserializer for a list.

Parameters:
input - To read from.
Returns:
A newly create list.
Throws:
IOException - If that fails
See Also:
DataCellSerializer.deserialize(DataCellDataInput)

create

public static BlobSupportDataCellList create(Collection<? extends DataCell> coll)
Factory method to create a list based on a collection.

If the underlying collection stems from a DataRow (as read from a any table), consider to use create(DataRow, int[]) in order to minimize cell access.

Parameters:
coll - The underlying collection.
Returns:
The newly created list.
Throws:
NullPointerException - If the argument is null or contains null values.

create

public static BlobSupportDataCellList create(DataRow row,
                                             int[] cols)
Create new list based on selected cell from a DataRow. Using this method will check if the row is returned by a BufferedDataTable and will handle blobs appropriately.

Parameters:
row - The underlying row
cols - The indices of interest.
Returns:
A newly create list.
Throws:
NullPointerException - If either argument is null.
IndexOutOfBoundsException - If the indices are invalid.


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.