|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsimple.util.tree.FullNode<T,K,V>
T - Type for node content.K - Type for property Keys.V - Type for property Values.public class FullNode<T,K,V>
Node that has it all.
| Field Summary | |
|---|---|
protected java.util.Vector<FullNode<T,K,V>> |
children
Vector of Nodes to hold any children. |
private T |
content
|
private int |
depth
|
private CIString |
nName
|
private FullNode<T,K,V> |
parent
|
protected java.util.HashMap<K,V> |
properties
HashMap to hold properties for this node. |
| Constructor Summary | |
|---|---|
protected |
FullNode()
|
|
FullNode(java.lang.String name)
Creates a Node and sets its name. |
|
FullNode(java.lang.String name,
FullNode<T,K,V> parent)
Creates a Node and sets its name and parent. |
|
FullNode(java.lang.String name,
FullNode<T,K,V> parent,
T content)
|
|
FullNode(java.lang.String name,
T content)
|
| Method Summary | |
|---|---|
void |
addChild(FullNode<T,K,V> cnode)
Adds a child Node and sets this as the node's parent. |
int |
childCount()
|
FullNode<T,K,V> |
getChild(int index)
Gets a child at the index specified. |
T |
getContent()
|
int |
getDepth()
Get which level of the tree the element is on. |
CIString |
getName()
|
FullNode<T,K,V> |
getParent()
|
V |
getProperty(K key)
|
boolean |
hasChild()
Checks if it has any children. |
boolean |
hasChild(FullNode<T,K,V> child)
|
boolean |
hasParent()
|
boolean |
hasProperty(K key)
|
boolean |
isChildOf(FullNode<T,K,V> parent)
|
boolean |
isRoot()
Checks if it has a parent and returns the result. |
void |
removeChild(FullNode<T,K,V> child)
Removes the specified Node from the list of children if it has any. |
void |
removeChild(int index)
Removes the child Node at the specified index if getChild(index)!=null. |
V |
removeProperty(K key)
Removes the key/value pair. |
void |
setContent(T object)
Sets the contents of the node. |
void |
setName(java.lang.String name)
Sets the name of the node. |
void |
setParent(FullNode<T,K,V> pnode)
Sets the parent of this node. |
V |
setProperty(K key,
V value)
Adds the key/value pair to the properties. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final java.util.Vector<FullNode<T,K,V>> children
protected java.util.HashMap<K,V> properties
private FullNode<T,K,V> parent
private CIString nName
private T content
private int depth
| Constructor Detail |
|---|
protected FullNode()
public FullNode(java.lang.String name)
name - Name of the node.
public FullNode(java.lang.String name,
FullNode<T,K,V> parent,
T content)
public FullNode(java.lang.String name,
T content)
public FullNode(java.lang.String name,
FullNode<T,K,V> parent)
name - Name of the node.parent - Parent of the node.| Method Detail |
|---|
public final void setContent(T object)
object - Object to set as the contents.public final T getContent()
public final void setName(java.lang.String name)
name - String to set as the Node's name.public final CIString getName()
public final void setParent(FullNode<T,K,V> pnode)
removeChild(this) on its parent before setting its parent
to the specified Node. Also adds itself to the new parent if
node.hasChild(this)!=true.
pnode - Node to be set as the parent of this Node.public final boolean hasParent()
getParent()!=null.public final FullNode<T,K,V> getParent()
public final boolean isRoot()
public final boolean hasChild()
public final boolean hasChild(FullNode<T,K,V> child)
child - Node to test if it is a child.
public final boolean isChildOf(FullNode<T,K,V> parent)
parent - Possible parent node.
parent.hasChild(this).public final void addChild(FullNode<T,K,V> cnode)
node==null.
cnode - Node to be added as a child.public final FullNode<T,K,V> getChild(int index)
index - Index of the child wanted.
public final int childCount()
public void removeChild(FullNode<T,K,V> child)
child - Node to be removed.public final void removeChild(int index)
index - Index of Node to be removed.public final V getProperty(K key)
key - The key for the value.
public final V setProperty(K key,
V value)
key - Key for the value.value - Value to be set for the property.
public final V removeProperty(K key)
key -
public final boolean hasProperty(K key)
key -
public java.lang.String toString()
toString in class java.lang.Objectpublic final int getDepth()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||