org.knime.core.data.def
Class DefaultRow

java.lang.Object
  extended by org.knime.core.data.def.DefaultRow
All Implemented Interfaces:
Iterable<DataCell>, DataRow

public class DefaultRow
extends Object
implements DataRow

Default row for DataCells which keeps a row identifier and an array of DataCell objects.

Author:
ohl, University of Konstanz

Constructor Summary
DefaultRow(RowKey rowKey, DataCell... row)
          Inits a new DefaultRow object by row key and an array of DataCells.
DefaultRow(RowKey key, DataRow row)
          Creates an new row, using the data of the specified row, and overwrites the row key with the given new one.
DefaultRow(RowKey rowKey, double... row)
          Inits a new DefaultRow object by row key and an array of double values.
DefaultRow(RowKey rowKey, int... row)
          Inits a new DefaultRow object by row key and an array of int values.
DefaultRow(RowKey rowKey, List<DataCell> row)
          Inits a new DefaultRow object by row id and an array of DataCells.
DefaultRow(RowKey rowKey, String... row)
          Inits a new DefaultRow object by row key and an array of String values.
DefaultRow(String rowId, DataCell... row)
          Inits a new DefaultRow object by row id and an array of DataCells.
DefaultRow(String rowId, DataRow row)
          Creates an new row, using the data of the specified row, and overwrites the row key with the given new one.
DefaultRow(String rowId, double... row)
          Inits a new DefaultRow object by row ID and an array of double values.
DefaultRow(String rowId, int... row)
          Inits a new DefaultRow object by row id and an array of int values.
DefaultRow(String rowId, List<DataCell> row)
          Inits a new DefaultRow object by row id and an array of DataCells.
DefaultRow(String rowId, String... row)
          Inits a new DefaultRow object by row id and an array of String values.
 
Method Summary
 boolean equals(Object obj)
          A row is equal to another one if the key and all cells are equal.
 DataCell getCell(int index)
          Returns the DataCell at the provided index within this row.
 RowKey getKey()
          Returns the row key.
 int getNumCells()
          Returns the length of this row, that is the number of columns of the DataTable (not including the row key).
 int hashCode()
          
 Iterator<DataCell> iterator()
          
 String toString()
          Get a string representing this row, i.e.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultRow

public DefaultRow(RowKey rowKey,
                  DataCell... row)
Inits a new DefaultRow object by row key and an array of DataCells. The content of the argument array is copied.

Parameters:
rowKey - A RowKey containing a row Id.
row - An array containing the actual data of this row.
Throws:
IllegalArgumentException - if the rowKey or row or one of its cell is null.

DefaultRow

public DefaultRow(String rowId,
                  DataCell... row)
Inits a new DefaultRow object by row id and an array of DataCells. The content of the argument array is copied.

Parameters:
rowId - A String containing a row Id.
row - An array containing the actual data of this row.
Throws:
NullPointerException - if the specified rowID is null
NullPointerException - if row or one of its cells is null.

DefaultRow

public DefaultRow(String rowId,
                  List<DataCell> row)
Inits a new DefaultRow object by row id and an array of DataCells. The content of the argument array is copied.

Parameters:
rowId - a String containing a row Id
row - a list containing the actual data of this row
Throws:
NullPointerException - if the specified rowID is null
NullPointerException - if row or one of its cells is null.

DefaultRow

public DefaultRow(RowKey rowKey,
                  List<DataCell> row)
Inits a new DefaultRow object by row id and an array of DataCells. The content of the argument array is copied.

Parameters:
rowKey - a RowKey containing a unique row Id
row - a list containing the actual data of this row
Throws:
NullPointerException - if the specified row key is null
NullPointerException - if row or one of its cells is null.

DefaultRow

public DefaultRow(RowKey rowKey,
                  double... row)
Inits a new DefaultRow object by row key and an array of double values.

Parameters:
rowKey - A RowKey containing a unique row Id.
row - An array containing the actual data of this row.
Throws:
NullPointerException - if the rowKey or row is null.

DefaultRow

public DefaultRow(String rowId,
                  double... row)
Inits a new DefaultRow object by row ID and an array of double values.

Parameters:
rowId - to be wrapped in a RowKey object
row - the values in the row
Throws:
NullPointerException - As soon as the other constructor does.
See Also:
DefaultRow(RowKey, double[])

DefaultRow

public DefaultRow(String rowId,
                  int... row)
Inits a new DefaultRow object by row id and an array of int values. Checks if none of the arguments is null.

Parameters:
rowId - a String containing a unique row Id.
row - an array containing the actual data of this row.
Throws:
NullPointerException - if the rowKey or row is null.

DefaultRow

public DefaultRow(RowKey rowKey,
                  int... row)
Inits a new DefaultRow object by row key and an array of int values. Checks if none of the arguments is null.

Parameters:
rowKey - a RowKey containing a unique row Id.
row - an array containing the actual data of this row.
Throws:
NullPointerException - if the rowKey or row is null.

DefaultRow

public DefaultRow(String rowId,
                  String... row)
Inits a new DefaultRow object by row id and an array of String values.

Parameters:
rowId - A String containing a unique row Id.
row - An array containing the actual data of this row.
Throws:
NullPointerException - if the rowId or row or one of its strings is null.

DefaultRow

public DefaultRow(RowKey rowKey,
                  String... row)
Inits a new DefaultRow object by row key and an array of String values.

Parameters:
rowKey - a RowKey containing a unique row Id
row - an array containing the actual data of this row
Throws:
NullPointerException - if the rowId or row or one of its strings is null.

DefaultRow

public DefaultRow(String rowId,
                  DataRow row)
Creates an new row, using the data of the specified row, and overwrites the row key with the given new one.

Parameters:
rowId - the row id to create the new row key.
row - The row to copy.
Throws:
IllegalArgumentException - If the key or one of the row's cells is null.
NullPointerException - If the row is null.

DefaultRow

public DefaultRow(RowKey key,
                  DataRow row)
Creates an new row, using the data of the specified row, and overwrites the row key with the given new one.

Parameters:
key - The new row's key.
row - The row to copy.
Throws:
IllegalArgumentException - If the key or one of the row's cells is null.
NullPointerException - If the row is null.
Method Detail

getNumCells

public final int getNumCells()
Returns the length of this row, that is the number of columns of the DataTable (not including the row key).

Specified by:
getNumCells in interface DataRow
Returns:
length of this row

getKey

public final RowKey getKey()
Returns the row key.

Specified by:
getKey in interface DataRow
Returns:
the row key

getCell

public final DataCell getCell(int index)
Returns the DataCell at the provided index within this row.

Specified by:
getCell in interface DataRow
Parameters:
index - the index of the cell to retrieve (indices start from 0)
Returns:
the DataCell at the given index

iterator

public Iterator<DataCell> iterator()

Specified by:
iterator in interface Iterable<DataCell>

toString

public String toString()
Get a string representing this row, i.e. "rowkey: (cell1, ..., celln)"

Overrides:
toString in class Object
Returns:
key + values of this row in a string

equals

public boolean equals(Object obj)
A row is equal to another one if the key and all cells are equal.

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object


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.