org.knime.core.data
Class DataColumnDomain

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

public final class DataColumnDomain
extends Object

Final DataColumnDomain object holding meta infos about one column, that are, possible values and/or upper and lower bounds - if available. This object can only be created by a DataColumnDomainCreator within this package. The DataColumnDomain is read-only.

Note: It is assumed that the domain - if available - contains reliable data. It is crucial that the creator of a column domain ensures that no value in the data table is outside the provided bounds and no other value appears in that column than the values listed in the set returned by getValues(). If you are not sure about the data to come in your column, don't provide domain infos (null).
Also noteworthy: domain information describes the source of the data (the domain), not the data itself. I.e. the created domain object could contain more possible values than actually appear in the data table, or a range bigger than needed for the data in that particular data table. But it must always include all values appearing in the table.

Author:
Thomas Gabriel, University of Konstanz
See Also:
DataColumnDomainCreator

Constructor Summary
DataColumnDomain(DataCell lower, DataCell upper, Set<DataCell> values)
          Create new column domain with lower and upper bounds, and set of possible values.
 
Method Summary
 boolean equals(Object obj)
          Compares this domain with the other one by the possible values and lower and upper bounds and returns true if both are the same.
 DataCell getLowerBound()
          Return the lower bound of the domain of this column, if available.
 DataCell getUpperBound()
          Return the upper bound of the domain of this column, if available.
 Set<DataCell> getValues()
          Returns all possible values in this column.
 boolean hasBounds()
          Returns true if both, lower and upper bound, are defined.
 int hashCode()
          Returns the hash code of this domain, based on the hash codes of the lower, upper bound, and each possible value - if available.
 boolean hasLowerBound()
          Returns true, if a lower bound is defined.
 boolean hasUpperBound()
          Returns true, if an upper bound is defined.
 boolean hasValues()
          Returns true if the values are not null.
static DataColumnDomain load(ConfigRO config)
          Reads lower and upper bounds as well as the possible values - if available - from ConfigRO.
 void save(ConfigWO config)
          Save this domain to the given ConfigWO including lower and upper bound, and possible values or null - if not available.
 String toString()
          Returns string representation of this domain including lower and upper bounds, and possible values.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataColumnDomain

DataColumnDomain(DataCell lower,
                 DataCell upper,
                 Set<DataCell> values)
Create new column domain with lower and upper bounds, and set of possible values. All arguments can be null in case none of these properties are available.

Parameters:
lower - the lower bound value or null
upper - the upper bound value or null
values - a set of nominal values or null
Method Detail

getValues

public Set<DataCell> getValues()
Returns all possible values in this column. Note, that this set can be null if this information is not available (for continuous double values, for example) and that the DataCells in the returned set do not have to be of the same type (but the column type should be compatible to all of their values).

If the returned set is not null, the corresponding column does not contain any value other than the ones contained in the set. The set can contain a superset of the values in the table though.

Returns:
a Set of possible DataCell values or null
See Also:
hasValues()

hasValues

public boolean hasValues()
Returns true if the values are not null.

Returns:
true, if this column has possible values defined ( i.e. the getValues() method returns a non-null set)
See Also:
getValues()

getLowerBound

public DataCell getLowerBound()
Return the lower bound of the domain of this column, if available. Note that this value does not necessarily need to actually occur in the corresponding DataTable but it is describing the range of the domain of this attribute.

Usually this value is compatible with type DoubleValue corresponding to an numeric left interval border.

Returns:
a DataCell with the lowest possible value or null
See Also:
hasLowerBound()

hasLowerBound

public boolean hasLowerBound()
Returns true, if a lower bound is defined.

Returns:
true, if the lower bound value has been defined
See Also:
getLowerBound()

getUpperBound

public DataCell getUpperBound()
Return the upper bound of the domain of this column, if available. Note that this value does not necessarily need to actually occur in the corresponding DataTable but it describes the range of the domain of this attribute.

Usually this value is compatible with type DoubleValue corresponding to an numeric right interval border.

Returns:
a DataCell with the largest possible value or null
See Also:
hasUpperBound()

hasUpperBound

public boolean hasUpperBound()
Returns true, if an upper bound is defined.

Returns:
true, if the upper bound value has been defined
See Also:
getUpperBound()

hasBounds

public boolean hasBounds()
Returns true if both, lower and upper bound, are defined.

Returns:
true, if lower and upper bound are defined

equals

public boolean equals(Object obj)
Compares this domain with the other one by the possible values and lower and upper bounds and returns true if both are the same.

Overrides:
equals in class Object
Parameters:
obj - The other domain to compare with.
Returns:
true if all possible values, and lower and upper bounds are the same
See Also:
Set.equals(Object), DataCell.equals(Object)

hashCode

public int hashCode()
Returns the hash code of this domain, based on the hash codes of the lower, upper bound, and each possible value - if available.

Overrides:
hashCode in class Object

toString

public String toString()
Returns string representation of this domain including lower and upper bounds, and possible values.

Overrides:
toString in class Object
Returns:
Summary as String.
See Also:
Object.toString()

save

public void save(ConfigWO config)
Save this domain to the given ConfigWO including lower and upper bound, and possible values or null - if not available.

Parameters:
config - the ConfigWO to write into

load

public static DataColumnDomain load(ConfigRO config)
Reads lower and upper bounds as well as the possible values - if available - from ConfigRO.

Parameters:
config - to read entries from
Returns:
a new domain object with the read properties


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.