org.knime.base.node.mine.sota.logic
Class SotaTreeCell

java.lang.Object
  extended by org.knime.base.node.mine.sota.logic.SotaTreeCell
All Implemented Interfaces:
Serializable, Hiliteable, Locatable, Selectable

public class SotaTreeCell
extends Object
implements Locatable, Hiliteable, Selectable, Serializable

Author:
Kilian Thiel, University of Konstanz
See Also:
Serialized Form

Field Summary
static String DEFAULT_CLASS
          Default cell class.
 
Fields inherited from interface org.knime.base.node.mine.sota.view.interaction.Locatable
X, Y
 
Constructor Summary
SotaTreeCell(int dimension, boolean isCell)
          Creates new instance of Cell with given dimension of data vector and given isCell flag.
SotaTreeCell(int dimension, int lev, boolean isCell)
          Creates new instance of Cell with given dimension of data vector, given level of hierarchy and given isCell flag.
SotaTreeCell(SotaCell[] dat, boolean isCell)
          Creates new instance of Cell with given vector data and given isCell flag.
SotaTreeCell(SotaCell[] dat, int lev, boolean isCell)
          Creates new instance of Cell with given vector data, given level of hierarchy and given isCell flag.
 
Method Summary
 void addTreeCellClass(String treeCellClass)
           
 void deselectSubtree()
          Deselects cell and all its children and subchildren recursively.
 SotaTreeCell getAncestor()
          Returns the cells ancestor.
 String getCellType()
           
 SotaCell[] getData()
          Returns the cells data array.
 String getDataAsString(int precision)
          Returns the cells data as String.
 ArrayList<Integer> getDataIds()
          Returns the cells Ids of according data sets.
 int getEndX()
          Returns the objects end X coordinate.
 int getEndY()
          Returns the objects end Y coordinate.
 int getHierarchyLevel()
           
 SotaTreeCell getLeft()
          Returns the left child Cell of the current Node, or null.
 int getLevel()
          Returns the cells level of hierarchy inside the binary tree.
 int getLevelInHierarchy()
           
 double getMaxDistance()
          Returns the maximum distance between the data related to the cell.
 double getResource()
          Returns the cells resource value.
 SotaTreeCell getRight()
          Returns the cells (Nodes) right child Cell.
 ArrayList<RowKey> getRowKeys()
           
 String getRowKeysAsString()
          Returns the RowKeys as a string separated with ",".
 SotaTreeCell getSister()
           
 int getStartX()
          Returns the objects start X coordinate.
 int getStartY()
          Returns the objects start Y coordinate.
 String getTreeCellClass()
           
 boolean isCell()
          Returns true if the cell is a Cell, false if it is a Node.
 boolean isHilited()
          Returns true if object is hilited, false if not.
 boolean isSelected()
          Returns true if object is selected, false if not.
 void loadFrom(ModelContentRO modelContent, int index, SotaTreeCell anchestor, boolean isLeft)
          Loads the values from the given ModelContentWO.
 void saveTo(ModelContentWO modelContent, int index)
          Saves the value of the SotaTreeCell to the given ModelContentWO.
 void setAncestor(SotaTreeCell anc)
          Sets the given ancestor value.
 void setCell(boolean cell)
          Sets the given isCell flag.
 void setCellHilited(boolean hilit)
          Sets the hilit flag to the cell without recursive method call.
 void setCellSelected(boolean select)
          Sets the select flag to the cell without recursive method call.
 void setData(SotaCell[] dat)
          Sets the given data array.
 void setDataIds(ArrayList<Integer> ids)
          Sets the given Ids of according data sets.
 void setEndX(int x)
          Sets the given end x coordinate.
 void setEndY(int y)
          Sets the given end y coordinate.
 void setHierarchyLevel(int level)
           
 void setHilited(boolean hilit)
          Sets the given hilit flag.
 void setLeft(SotaTreeCell l)
          Sets the cells (Nodes) left child Cell.
 void setLevel(int lev)
          Sets the cells level of hierarchy inside the binary tree.
 void setLevelInHierarchy(int levelInHierarchy)
           
 void setMaxDistance(double maxDist)
          Sets the given value as maximum distance between the data related to the cell.
 void setResource(double res)
          Sets the given value as the cells resource value.
 void setRight(SotaTreeCell r)
          Sets the given Cell as the cells right child Cell.
 void setSelected(boolean select)
          Sets the given select flag.
 void setSister(SotaTreeCell sister)
           
 void setStartX(int x)
          Sets the given start x coordinate.
 void setStartY(int y)
          Sets the given start y coordinate.
 void split()
          Splits the current cell that it becomes a Node.
 void split(int hierarchicalLev)
          Splits the current cell that it becomes a Node.
 void split(int lev, int hierarchicalLev)
          Splits the current cell that it becomes a Node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CLASS

public static final String DEFAULT_CLASS
Default cell class.

See Also:
Constant Field Values
Constructor Detail

SotaTreeCell

public SotaTreeCell(int dimension,
                    int lev,
                    boolean isCell)
Creates new instance of Cell with given dimension of data vector, given level of hierarchy and given isCell flag.

Parameters:
dimension - Dimension of the data vector.
lev - hierarchy level of the cell
isCell - flags if cell is a Cell or a Node

SotaTreeCell

public SotaTreeCell(int dimension,
                    boolean isCell)
Creates new instance of Cell with given dimension of data vector and given isCell flag. The hierarchz level ist set to 0 by default.

Parameters:
dimension - dimension of the data vector
isCell - flags if cell is a Cell or a Node

SotaTreeCell

public SotaTreeCell(SotaCell[] dat,
                    int lev,
                    boolean isCell)
Creates new instance of Cell with given vector data, given level of hierarchy and given isCell flag.

Parameters:
dat - data to set to the data vector
lev - hierarchy level of the cell
isCell - flags if Cell is a Cell or a Node

SotaTreeCell

public SotaTreeCell(SotaCell[] dat,
                    boolean isCell)
Creates new instance of Cell with given vector data and given isCell flag. The level of hierarchy is set to 0 by default.

Parameters:
dat - data to set to the data vector
isCell - flags if cell is a Cell or a Node
Method Detail

getTreeCellClass

public String getTreeCellClass()
Returns:
the class of the tree cell.

addTreeCellClass

public void addTreeCellClass(String treeCellClass)
Parameters:
treeCellClass - the class to assign to the tree cell.

split

public void split(int lev,
                  int hierarchicalLev)
Splits the current cell that it becomes a Node. The child cells have the same data as the ancestor and the given level. The maximum distnace and resource values are set to 0 be default and the data Id vector is empty.

Parameters:
lev - the level to set to the newly created cells
hierarchicalLev - the fuzzy rule level (is only used when training with hierarchical fuzzy data)

split

public void split(int hierarchicalLev)
Splits the current cell that it becomes a Node. The child cells have the same data and level as the ancestor. The maximum distance and resource values are set to 0 be default and the data Id vector is empty.

Parameters:
hierarchicalLev - the fuzzy rule level (is only used when training with hierarchical fuzzy data)

split

public void split()
Splits the current cell that it becomes a Node. The child cells have the same data and level as the ancestor. The maximum distance and resource values are set to 0 be default the data Id vector is empty and the hierarchy level is set to 1.


getDataAsString

public String getDataAsString(int precision)
Returns the cells data as String. The values are comma separated and the given decimal precision defines the decimal precision of the values.

Parameters:
precision - the decimal precision to use for the values
Returns:
the cells data as string

getAncestor

public SotaTreeCell getAncestor()
Returns the cells ancestor.

Returns:
the cells ancestor

setAncestor

public void setAncestor(SotaTreeCell anc)
Sets the given ancestor value.

Parameters:
anc - the cells ancestor to set

getSister

public SotaTreeCell getSister()
Returns:
the sister

setSister

public void setSister(SotaTreeCell sister)
Parameters:
sister - The sister to set.

getData

public SotaCell[] getData()
Returns the cells data array.

Returns:
the cells data array

setData

public void setData(SotaCell[] dat)
Sets the given data array.

Parameters:
dat - the cells data array to set

getDataIds

public ArrayList<Integer> getDataIds()
Returns the cells Ids of according data sets.

Returns:
the cells Ids of according data sets

setDataIds

public void setDataIds(ArrayList<Integer> ids)
Sets the given Ids of according data sets.

Parameters:
ids - the cells Ids of according data sets to set

isCell

public boolean isCell()
Returns true if the cell is a Cell, false if it is a Node.

Returns:
true if the cell is a Cell, false if it is a Node

setCell

public void setCell(boolean cell)
Sets the given isCell flag. If true it is a Cell else it is a Node.

Parameters:
cell - if true it is a Cell else it is a Node

getLeft

public SotaTreeCell getLeft()
Returns the left child Cell of the current Node, or null.

Returns:
the left child Cell of the current Node, or null

setLeft

public void setLeft(SotaTreeCell l)
Sets the cells (Nodes) left child Cell.

Parameters:
l - the cells (Nodes) left child Cell to set

getLevel

public int getLevel()
Returns the cells level of hierarchy inside the binary tree.

Returns:
the cells level of hierarchy inside the binary tree

setLevel

public void setLevel(int lev)
Sets the cells level of hierarchy inside the binary tree.

Parameters:
lev - the cells level of hierarchy inside the binary tree to set

getMaxDistance

public double getMaxDistance()
Returns the maximum distance between the data related to the cell.

Returns:
the maximum distance between the data related to the cell

setMaxDistance

public void setMaxDistance(double maxDist)
Sets the given value as maximum distance between the data related to the cell.

Parameters:
maxDist - the maximum distance between the data related to the cell to set

getResource

public double getResource()
Returns the cells resource value.

Returns:
the cells resource value

setResource

public void setResource(double res)
Sets the given value as the cells resource value.

Parameters:
res - the value to set as the cells resource value

getRight

public SotaTreeCell getRight()
Returns the cells (Nodes) right child Cell.

Returns:
the cells (Nodes) right child Cell

setRight

public void setRight(SotaTreeCell r)
Sets the given Cell as the cells right child Cell.

Parameters:
r - the Cell to set as the cells right child Cell

getStartX

public int getStartX()
Returns the objects start X coordinate.

Specified by:
getStartX in interface Locatable
Returns:
the objects start X coordinate

getStartY

public int getStartY()
Returns the objects start Y coordinate.

Specified by:
getStartY in interface Locatable
Returns:
the objects start Y coordinate

getEndX

public int getEndX()
Returns the objects end X coordinate.

Specified by:
getEndX in interface Locatable
Returns:
the objects end X coordinate

getEndY

public int getEndY()
Returns the objects end Y coordinate.

Specified by:
getEndY in interface Locatable
Returns:
the objects end Y coordinate

setStartX

public void setStartX(int x)
Sets the given start x coordinate.

Specified by:
setStartX in interface Locatable
Parameters:
x - the start x coordinate to set

setStartY

public void setStartY(int y)
Sets the given start y coordinate.

Specified by:
setStartY in interface Locatable
Parameters:
y - the start y coordinate to set

setEndX

public void setEndX(int x)
Sets the given end x coordinate.

Specified by:
setEndX in interface Locatable
Parameters:
x - the end x coordinate to set

setEndY

public void setEndY(int y)
Sets the given end y coordinate.

Specified by:
setEndY in interface Locatable
Parameters:
y - the end y coordinate to set

isHilited

public boolean isHilited()
Returns true if object is hilited, false if not.

Specified by:
isHilited in interface Hiliteable
Returns:
true if object is hilited, false if not

setHilited

public void setHilited(boolean hilit)
Sets the given hilit flag.

Specified by:
setHilited in interface Hiliteable
Parameters:
hilit - hilitflag to set

setCellHilited

public void setCellHilited(boolean hilit)
Sets the hilit flag to the cell without recursive method call.

Parameters:
hilit - flag to set

getHierarchyLevel

public int getHierarchyLevel()
Returns:
the hierarchyLevel

setHierarchyLevel

public void setHierarchyLevel(int level)
Parameters:
level - the hierarchyLevel to set

getLevelInHierarchy

public int getLevelInHierarchy()
Returns:
the levelInHierarchy

setLevelInHierarchy

public void setLevelInHierarchy(int levelInHierarchy)
Parameters:
levelInHierarchy - the levelInHierarchy to set

getRowKeys

public ArrayList<RowKey> getRowKeys()
Returns:
the rowKeys

getCellType

public String getCellType()
Returns:
the type of the cells data (fuzzy or double / number).

getRowKeysAsString

public String getRowKeysAsString()
Returns the RowKeys as a string separated with ",".

Returns:
the RowKeys as a string separated with ","

isSelected

public boolean isSelected()
Returns true if object is selected, false if not.

Specified by:
isSelected in interface Selectable
Returns:
true if object is selected, false if not

setSelected

public void setSelected(boolean select)
Sets the given select flag.

Specified by:
setSelected in interface Selectable
Parameters:
select - selectflag to set

setCellSelected

public void setCellSelected(boolean select)
Sets the select flag to the cell without recursive method call.

Parameters:
select - flag to set

deselectSubtree

public void deselectSubtree()
Deselects cell and all its children and subchildren recursively.


saveTo

public final void saveTo(ModelContentWO modelContent,
                         int index)
Saves the value of the SotaTreeCell to the given ModelContentWO.

Parameters:
modelContent - The ModelContentWO to save the cells to.
index - The index of the cell to save.

loadFrom

public void loadFrom(ModelContentRO modelContent,
                     int index,
                     SotaTreeCell anchestor,
                     boolean isLeft)
              throws InvalidSettingsException
Loads the values from the given ModelContentWO.

Parameters:
modelContent - The ModelContentWO to load the cells from.
index - The index of the cell to load.
anchestor - The anchsetor cell of the cell to load.
isLeft - Specifies if the cell to load is a cell at the left side of its anchestor.
Throws:
InvalidSettingsException - If setting to load is not valid.


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.