org.knime.core.data
Class DataColumnSpec

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

public final class DataColumnSpec
extends Object

A DataColumnSpec describes one column in a DataTable. It contains information about type, name, domain, data properties, and optionally color/size/shape handling. This class can only be created using the DataColumnSpecCreator within this package.

Author:
Michael Berthold, University of Konstanz
See Also:
DataColumnSpecCreator, DataTableSpec

Constructor Summary
DataColumnSpec(String name, String[] elNames, DataType type, DataColumnDomain domain, DataColumnProperties props, SizeHandler sizeHdl, ColorHandler colorHdl, ShapeHandler shapeHdl)
          Constructor taking all properties of this column spec as arguments.
 
Method Summary
 boolean equals(Object o)
          Two DataColumnSpecs are equal, if the name, type, properties, domain, all property handlers, and element names are equal.
 boolean equalStructure(DataColumnSpec cspec)
          Two DataColumnSpecs are equal if they have the same column name and type.
 ColorHandler getColorHandler()
          Returns the ColorHandler defined on this column, if available.
 DataColumnDomain getDomain()
          Returns the domain of this column spec including meta-information such as bounds, possible values, etc.
 List<String> getElementNames()
          Get names of sub elements such as bit vector positions or elements of other vector data types.
 String getName()
          Returns the name of this column.
 DataColumnProperties getProperties()
          Returns the properties assigned to this column spec.
 ShapeHandler getShapeHandler()
          Returns the ShapeHandler defined on this column, if available.
 SizeHandler getSizeHandler()
          Returns the SizeHandler defined on this column, if available.
 DataType getType()
          Returns the column type which is a subclass of DataType.
 int hashCode()
          The hash code is computed based on the hash code of column name and type.
static DataColumnSpec load(ConfigRO config)
          Reads name, type, domain, and properties from the given ConfigRO and - if available - size, shape, and color handler.
 void save(ConfigWO config)
          Saves name, type, domain, and properties and - if available - color, size, and shape handler to the given ConfigWO.
 String toString()
          Returns a string summary of this column spec including name and type.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataColumnSpec

DataColumnSpec(String name,
               String[] elNames,
               DataType type,
               DataColumnDomain domain,
               DataColumnProperties props,
               SizeHandler sizeHdl,
               ColorHandler colorHdl,
               ShapeHandler shapeHdl)
Constructor taking all properties of this column spec as arguments. It creates a read-only DataColumnSpec and should only be called from the DataColumnSpecCreator in this package.

Parameters:
name - the name of the column, must not be null
elNames - Names of sub elements (if any), must not be null, nor contain null elements.
type - the type of the column, must not be null
domain - the domain, must not be null
props - additional properties, must not be null
sizeHdl - the SizeHandler or null
colorHdl - the ColorHandler or null
shapeHdl - the ShapeHandler or null
Throws:
NullPointerException - if either column name, type, domain, or properties are null
Method Detail

getName

public String getName()
Returns the name of this column.

Returns:
the column name

getElementNames

public List<String> getElementNames()
Get names of sub elements such as bit vector positions or elements of other vector data types. For non-vector types (most types are non-vector types) this list is typically empty. For vector type columns (i.e. those which contain vectors of DataCell or a BitVectorCell) the elements of this list represent identifiers for each of the different vector positions. There is, however, no need that such a list is set.

Returns:
Names of the elements in a unmodifiable, random access list. The returned value will never be null, nor contain null elements. The length of the list may vary from 0 to any length.

getType

public DataType getType()
Returns the column type which is a subclass of DataType.

Returns:
the DataType of this column; all data cells of this column are type-castable to its native type
See Also:
DataType, DataCell

getDomain

public DataColumnDomain getDomain()
Returns the domain of this column spec including meta-information such as bounds, possible values, etc.

Returns:
the domain of the column spec; can be empty, but never null

getProperties

public DataColumnProperties getProperties()
Returns the properties assigned to this column spec. These properties can be seen as some sort of annotations to this column.

Returns:
the column's annotation properties, never null

getSizeHandler

public SizeHandler getSizeHandler()
Returns the SizeHandler defined on this column, if available. Otherwise null will be returned.

Returns:
attached SizeHandler or null

getShapeHandler

public ShapeHandler getShapeHandler()
Returns the ShapeHandler defined on this column, if available. Otherwise null will be returned.

Returns:
atached ShapeHandler or null

getColorHandler

public ColorHandler getColorHandler()
Returns the ColorHandler defined on this column, if available. Otherwise null will be returned.

Returns:
attached ColorHandler or null

equalStructure

public boolean equalStructure(DataColumnSpec cspec)
Two DataColumnSpecs are equal if they have the same column name and type. Domain info, properties, and handlers are not considered during the comparison.

Parameters:
cspec - another DataColumnSpec to compare this column to
Returns:
true if both have the same column name and type, otherwise false
See Also:
Object.equals(java.lang.Object)

equals

public boolean equals(Object o)
Two DataColumnSpecs are equal, if the name, type, properties, domain, all property handlers, and element names are equal.

Overrides:
equals in class Object
Parameters:
o - the DataColumnSpec to check equality
Returns:
true if both objects are equal, otherwise false

hashCode

public int hashCode()
The hash code is computed based on the hash code of column name and type.

Overrides:
hashCode in class Object

toString

public String toString()
Returns a string summary of this column spec including name and type.

Overrides:
toString in class Object
Returns:
a string summary of this column spec with column name and type

save

public void save(ConfigWO config)
Saves name, type, domain, and properties and - if available - color, size, and shape handler to the given ConfigWO.

Parameters:
config - write properties into
Throws:
NullPointerException - if the config object is null

load

public static DataColumnSpec load(ConfigRO config)
                           throws InvalidSettingsException
Reads name, type, domain, and properties from the given ConfigRO and - if available - size, shape, and color handler. Returns a new DataColumnSpec object initialized with the information read.

Parameters:
config - to read properties from
Returns:
a new column spec object
Throws:
InvalidSettingsException - if one of the non-optional properties is not available or can't be initialized
NullPointerException - if the config object is null


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.