org.knime.core.node.config
Class AbstractConfigEntry

java.lang.Object
  extended by org.knime.core.node.config.AbstractConfigEntry
All Implemented Interfaces:
Serializable, TreeNode
Direct Known Subclasses:
Config, ConfigBooleanEntry, ConfigByteEntry, ConfigCharEntry, ConfigDoubleEntry, ConfigFloatEntry, ConfigIntEntry, ConfigLongEntry, ConfigShortEntry, ConfigStringEntry

abstract class AbstractConfigEntry
extends Object
implements Serializable, TreeNode

Abstract Config entry holding only a Config entry type. Deriving classes must store the corresponding value and implement.

Author:
Thomas Gabriel, University of Konstanz

Constructor Summary
AbstractConfigEntry(ConfigEntries type, String key)
          Creates a new Config entry by the given key and type.
 
Method Summary
 Enumeration<TreeNode> children()
           
 boolean equals(Object o)
          Config entries are equal if they are identical.
 boolean getAllowsChildren()
           
 TreeNode getChildAt(int childIndex)
           
 int getChildCount()
           
 int getIndex(TreeNode node)
           
 String getKey()
          Returns the key for this entry.
 TreeNode getParent()
           
(package private)  ConfigEntries getType()
           
 int hashCode()
          
(package private) abstract  boolean hasIdenticalValue(AbstractConfigEntry ace)
          Derived classes must compare their value with the value in the passed argument (on equality).
 boolean isIdentical(AbstractConfigEntry ace)
          Checks the identity of two config entries.
 boolean isLeaf()
           
(package private)  void setKey(String key)
          Set a new key.
(package private)  void setParent(AbstractConfigEntry parent)
          Sets the parent for this entry which is null if not available.
 String toString()
          String summary of this object including key, type, and value.
(package private) abstract  String toStringValue()
          Returns a String representation for this Config entry which is the used to re-load this Config entry.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractConfigEntry

AbstractConfigEntry(ConfigEntries type,
                    String key)
Creates a new Config entry by the given key and type.

Parameters:
type - enum type within the ConfigEntries
key - The key under which this value is added.
Throws:
IllegalArgumentException - if the type or key is null
Method Detail

getKey

public final String getKey()
Returns the key for this entry.

Returns:
the key

setKey

final void setKey(String key)
Set a new key.

Parameters:
key - the key to set
Throws:
IllegalArgumentException - If argument is null.

setParent

final void setParent(AbstractConfigEntry parent)
Sets the parent for this entry which is null if not available.

Parameters:
parent - The new parent of the entry.

getType

final ConfigEntries getType()
Returns:
This Config's type.

toString

public String toString()
String summary of this object including key, type, and value.

Overrides:
toString in class Object
Returns:
key + type + value
See Also:
Object.toString()

toStringValue

abstract String toStringValue()
Returns a String representation for this Config entry which is the used to re-load this Config entry.

Returns:
A String representing this Config entry which can be null.

equals

public boolean equals(Object o)
Config entries are equal if they are identical.

Overrides:
equals in class Object
Parameters:
o - The other object to check against.
Returns:
true, if isIdentical(AbstractConfigEntry) returns true.

isIdentical

public final boolean isIdentical(AbstractConfigEntry ace)
Checks the identity of two config entries. They are identical if they have the same name, are of the same name, and have identical values which is checked by hasIdenticalValue, implemented in the derived classes.

Parameters:
ace - Entry to check if identical.
Returns:
true, if name, type, and value are identical.

hasIdenticalValue

abstract boolean hasIdenticalValue(AbstractConfigEntry ace)
Derived classes must compare their value with the value in the passed argument (on equality). They can safely assume that the specified object has the same java class, the same type and key.

Parameters:
ace - the argument to compare the value with
Returns:
true if the specified argument stores the same value as this.

hashCode

public int hashCode()

Overrides:
hashCode in class Object

getChildAt

public TreeNode getChildAt(int childIndex)
Specified by:
getChildAt in interface TreeNode
Parameters:
childIndex - Not is use.
Returns:
null, always.

getChildCount

public int getChildCount()
Specified by:
getChildCount in interface TreeNode
Returns:
0, always.
See Also:
TreeNode.getChildCount()

getParent

public final TreeNode getParent()
Specified by:
getParent in interface TreeNode
Returns:
The parent Config of this object.
See Also:
TreeNode.getParent()

getIndex

public int getIndex(TreeNode node)
Specified by:
getIndex in interface TreeNode
Parameters:
node - Not in use.
Returns:
-1, always.
See Also:
TreeNode.getIndex(javax.swing.tree.TreeNode)

getAllowsChildren

public final boolean getAllowsChildren()
Specified by:
getAllowsChildren in interface TreeNode
Returns:
true, if not a leaf, always.
See Also:
TreeNode.getAllowsChildren()

isLeaf

public boolean isLeaf()
Specified by:
isLeaf in interface TreeNode
Returns:
true, always.
See Also:
TreeNode.isLeaf()

children

public Enumeration<TreeNode> children()
Specified by:
children in interface TreeNode
Returns:
An empty enumeration.
See Also:
DefaultMutableTreeNode.EMPTY_ENUMERATION, TreeNode.children()


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.