org.knime.core.data.property
Class ColorModelNominal

java.lang.Object
  extended by org.knime.core.data.property.ColorModelNominal
All Implemented Interfaces:
Iterable<DataCell>, ColorHandler.ColorModel

public final class ColorModelNominal
extends Object
implements ColorHandler.ColorModel, Iterable<DataCell>

Color model which maps a set of DataCell objects to Color.


Constructor Summary
ColorModelNominal(Map<DataCell,ColorAttr> map)
          Creates new ColorHandler based on a mapping.
 
Method Summary
 boolean equals(Object obj)
          
 ColorAttr getColorAttr(DataCell dc)
          Returns a ColorAttr for the given DataCell value, or ColorAttr.DEFAULT if not set.
 int hashCode()
          
 Iterator<DataCell> iterator()
          Returns an iterator over the keys.
static ColorModelNominal load(ConfigRO config)
          Read color settings from given Config and returns a new ColorModelNominal object.
 String printColorMapping()
           
 void save(ConfigWO config)
          Saves the DataCell to Color mapping to the given Config.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColorModelNominal

public ColorModelNominal(Map<DataCell,ColorAttr> map)
Creates new ColorHandler based on a mapping.

Parameters:
map - Mapping form DataCell values to ColorAttr objects.
Throws:
IllegalArgumentException - If the map is null.
Method Detail

getColorAttr

public ColorAttr getColorAttr(DataCell dc)
Returns a ColorAttr for the given DataCell value, or ColorAttr.DEFAULT if not set.

Specified by:
getColorAttr in interface ColorHandler.ColorModel
Parameters:
dc - A DataCell value to get color for.
Returns:
A ColorAttr for a DataCell value.

iterator

public Iterator<DataCell> iterator()
Returns an iterator over the keys.

Specified by:
iterator in interface Iterable<DataCell>
Returns:
- returns an iterator over the keys.
See Also:
Iterable.iterator()

save

public void save(ConfigWO config)
Saves the DataCell to Color mapping to the given Config. The color is split into red, green, blue, and alpha component which are stored as int array.

Specified by:
save in interface ColorHandler.ColorModel
Parameters:
config - Save settings to.
Throws:
NullPointerException - If the config is null.
See Also:
#save(ConfigWO)

load

public static ColorModelNominal load(ConfigRO config)
                              throws InvalidSettingsException
Read color settings from given Config and returns a new ColorModelNominal object.

Parameters:
config - Reads color model from.
Returns:
A new ColorModelNominal object.
Throws:
InvalidSettingsException - If the color model settings could not be read.
NullPointerException - If the config is null.

printColorMapping

public String printColorMapping()
Returns:
A String for this ColorModel as list of DataCell to Color mapping.

toString

public String toString()
Overrides:
toString in class Object
Returns:
Nominal ColorModel
See Also:
Object.toString()

equals

public boolean equals(Object obj)

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.