org.knime.core.data
Class RowKey

java.lang.Object
  extended by org.knime.core.data.RowKey

public final class RowKey
extends Object

Key for a specific row which holds an identifier of type String.

Author:
Michael Berthold, University of Konstanz
See Also:
DataRow

Constructor Summary
RowKey(String id)
          Creates a row key based on a String.
 
Method Summary
static RowKey createRowKey(int rowIndex)
          Factory method to create "default" row IDs based on the row index.
 boolean equals(Object obj)
          
 String getString()
           
 int hashCode()
          
static RowKey[] toRowKeys(String... strs)
          Converts the given array of Strings to an array of RowKey elements by calling RowKey(String).
 String toString()
          
static String[] toStrings(RowKey... rowKeys)
          Converts the given array of RowKeys to an array of String elements by calling getString().
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RowKey

public RowKey(String id)
Creates a row key based on a String.

Parameters:
id - identifier for this key
Throws:
NullPointerException - if argument is null
Method Detail

getString

public String getString()
Returns:
Underlying string of this row key.

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

toStrings

public static String[] toStrings(RowKey... rowKeys)
Converts the given array of RowKeys to an array of String elements by calling getString().

Parameters:
rowKeys - an array of RowKey elements which can be null
Returns:
an array of String elements

toRowKeys

public static RowKey[] toRowKeys(String... strs)
Converts the given array of Strings to an array of RowKey elements by calling RowKey(String).

Parameters:
strs - an array of String elements which can be null
Returns:
an array of RowKey elements

createRowKey

public static RowKey createRowKey(int rowIndex)
Factory method to create "default" row IDs based on the row index. This method should be used in all cases where row keys are auto-generated (e.g. they are not read from a file) in order to comply to standard naming conventions. The returned key will be in the form of "Row" + rowIndex.

Parameters:
rowIndex - The index of the row, for which to generate a key. The first row has index 0. Note that non-negative values for rowIndex are perfectly legal but not encouraged.
Returns:
A new key of the form "Row" + rowIndex


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.