com.rapidminer.example.table
Class DataRowFactory

java.lang.Object
  extended by com.rapidminer.example.table.DataRowFactory

public class DataRowFactory
extends java.lang.Object

Factory class for DataRow objects. One factory should be used for one ExampleTable only. This class is necessary to customize implementations of DataRowReader to create DataRows of arbitrary type.

Author:
Ingo Mierswa, Simon Fischer

Field Summary
static int FIRST_TYPE_INDEX
           
static int LAST_TYPE_INDEX
           
static int TYPE_BOOLEAN_ARRAY
           
static int TYPE_BOOLEAN_SPARSE_ARRAY
           
static int TYPE_BYTE_ARRAY
           
static int TYPE_BYTE_SPARSE_ARRAY
           
static int TYPE_DOUBLE_ARRAY
           
static int TYPE_DOUBLE_SPARSE_ARRAY
           
static int TYPE_FLOAT_ARRAY
           
static int TYPE_FLOAT_SPARSE_ARRAY
           
static int TYPE_INT_ARRAY
           
static int TYPE_INT_SPARSE_ARRAY
           
static int TYPE_LONG_ARRAY
           
static int TYPE_LONG_SPARSE_ARRAY
           
static java.lang.String[] TYPE_NAMES
           
static int TYPE_SHORT_ARRAY
           
static int TYPE_SHORT_SPARSE_ARRAY
           
static int TYPE_SPARSE_MAP
           
 
Constructor Summary
DataRowFactory(int type)
          Deprecated. Please do not use this constructor any longer. Use the constructor DataRowFactory(int, char) instead.
DataRowFactory(int type, char decimalPointCharacter)
           
 
Method Summary
 DataRow create(java.lang.Double[] data, Attribute[] attributes)
          Creates a data row from an Object array.
 DataRow create(int size)
          Creates a new DataRow with the given initial capacity.
 DataRow create(java.lang.Object[] data, Attribute[] attributes)
          Creates a data row from an Object array.
 DataRow create(java.lang.String[] strings, Attribute[] attributes)
          Creates a data row from an array of Strings.
 int getType()
          Returns the type of the created data rows.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_NAMES

public static final java.lang.String[] TYPE_NAMES

FIRST_TYPE_INDEX

public static final int FIRST_TYPE_INDEX
See Also:
Constant Field Values

TYPE_DOUBLE_ARRAY

public static final int TYPE_DOUBLE_ARRAY
See Also:
Constant Field Values

TYPE_FLOAT_ARRAY

public static final int TYPE_FLOAT_ARRAY
See Also:
Constant Field Values

TYPE_LONG_ARRAY

public static final int TYPE_LONG_ARRAY
See Also:
Constant Field Values

TYPE_INT_ARRAY

public static final int TYPE_INT_ARRAY
See Also:
Constant Field Values

TYPE_SHORT_ARRAY

public static final int TYPE_SHORT_ARRAY
See Also:
Constant Field Values

TYPE_BYTE_ARRAY

public static final int TYPE_BYTE_ARRAY
See Also:
Constant Field Values

TYPE_BOOLEAN_ARRAY

public static final int TYPE_BOOLEAN_ARRAY
See Also:
Constant Field Values

TYPE_DOUBLE_SPARSE_ARRAY

public static final int TYPE_DOUBLE_SPARSE_ARRAY
See Also:
Constant Field Values

TYPE_FLOAT_SPARSE_ARRAY

public static final int TYPE_FLOAT_SPARSE_ARRAY
See Also:
Constant Field Values

TYPE_LONG_SPARSE_ARRAY

public static final int TYPE_LONG_SPARSE_ARRAY
See Also:
Constant Field Values

TYPE_INT_SPARSE_ARRAY

public static final int TYPE_INT_SPARSE_ARRAY
See Also:
Constant Field Values

TYPE_SHORT_SPARSE_ARRAY

public static final int TYPE_SHORT_SPARSE_ARRAY
See Also:
Constant Field Values

TYPE_BYTE_SPARSE_ARRAY

public static final int TYPE_BYTE_SPARSE_ARRAY
See Also:
Constant Field Values

TYPE_BOOLEAN_SPARSE_ARRAY

public static final int TYPE_BOOLEAN_SPARSE_ARRAY
See Also:
Constant Field Values

TYPE_SPARSE_MAP

public static final int TYPE_SPARSE_MAP
See Also:
Constant Field Values

LAST_TYPE_INDEX

public static final int LAST_TYPE_INDEX
See Also:
Constant Field Values
Constructor Detail

DataRowFactory

@Deprecated
public DataRowFactory(int type)
Deprecated. Please do not use this constructor any longer. Use the constructor DataRowFactory(int, char) instead.

Parameters:
type - must be one out of TYPE_DOUBLE_ARRAY, TYPE_FLOAT_ARRAY, TYPE_LONG_ARRAY, TYPE_INT_ARRAY, TYPE_SHORT_ARRAY, TYPE_BYTE_ARRAY, TYPE_BOOLEAN_ARRAY, TYPE_DOUBLE_SPARSE_ARRAY, TYPE_FLOAT_SPARSE_ARRAY, TYPE_SHORT_SPARSE_ARRAY, TYPE_BYTE_SPARSE_ARRAY, TYPE_BOOLEAN_SPARSE_ARRAY, or TYPE_SPARSE_MAP.

DataRowFactory

public DataRowFactory(int type,
                      char decimalPointCharacter)
Parameters:
type - must be one out of TYPE_DOUBLE_ARRAY, TYPE_FLOAT_ARRAY, TYPE_LONG_ARRAY, TYPE_INT_ARRAY, TYPE_SHORT_ARRAY, TYPE_BYTE_ARRAY, TYPE_BOOLEAN_ARRAY, TYPE_DOUBLE_SPARSE_ARRAY, TYPE_FLOAT_SPARSE_ARRAY, TYPE_LONG_SPARSE_ARRAY, TYPE_INT_SPARSE_ARRAY, TYPE_SHORT_SPARSE_ARRAY, TYPE_BYTE_SPARSE_ARRAY, TYPE_BOOLEAN_SPARSE_ARRAY, or TYPE_SPARSE_MAP.
decimalPointCharacter - the letter for decimal points, usually '.'
Method Detail

create

public DataRow create(int size)
Creates a new DataRow with the given initial capacity.


create

public DataRow create(java.lang.String[] strings,
                      Attribute[] attributes)
Creates a data row from an array of Strings. If the corresponding attribute is nominal, the string is mapped to its index, otherwise it is parsed using Double.parseDouble(String) .

See Also:
FileDataRowReader

create

public DataRow create(java.lang.Object[] data,
                      Attribute[] attributes)
Creates a data row from an Object array. The classes of the object must match the value type of the corresponding Attribute. If the corresponding attribute is nominal, data[i] will be cast to String. If it is numerical, it will be cast to Number.

Throws:
java.lang.ClassCastException - if data class does not match attribute type
See Also:
DatabaseDataRowReader

create

public DataRow create(java.lang.Double[] data,
                      Attribute[] attributes)
Creates a data row from an Object array. The classes of the object must match the value type of the corresponding Attribute. If the corresponding attribute is nominal, data[i] will be cast to String. If it is numerical, it will be cast to Number.

Throws:
java.lang.ClassCastException - if data class does not match attribute type
See Also:
DatabaseDataRowReader

getType

public int getType()
Returns the type of the created data rows.



Copyright © 2001-2009 by Rapid-I