org.jscience.util
Class NAryTree

java.lang.Object
  extended by org.jscience.util.NAryTree
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Tree
Direct Known Subclasses:
Organigram

public class NAryTree
extends java.lang.Object
implements Tree, Cloneable, java.io.Serializable

A class representing a tree data structure with many child elements.

See Also:
Serialized Form

Constructor Summary
NAryTree()
          Creates a new NAryTree object.
NAryTree(java.lang.Object o)
          Creates a new NAryTree object.
 
Method Summary
 boolean addChild(NAryTree child)
          DOCUMENT ME!
 java.lang.Object clone()
          DOCUMENT ME!
 boolean equals(java.lang.Object o)
          DOCUMENT ME!
static NAryTree extractNAryTree(NAryTree tree1, NAryTree tree2)
          DOCUMENT ME!
 java.util.Set getAllChildren()
          DOCUMENT ME!
 java.util.Set getChildren()
          DOCUMENT ME!
static NAryTree getCommonRoot(NAryTree tree1, NAryTree tree2)
          DOCUMENT ME!
 java.lang.Object getContents()
          DOCUMENT ME!
 int getDepth()
          DOCUMENT ME!
static java.util.Vector getLineage(NAryTree tree1, NAryTree tree2)
          DOCUMENT ME!
 NAryTree getParent()
          DOCUMENT ME!
 NAryTree getRoot()
          DOCUMENT ME!
static NAryTree getRoot(NAryTree tree)
          DOCUMENT ME!
 boolean hasChild()
          DOCUMENT ME!
 boolean hasChild(NAryTree child)
          DOCUMENT ME!
 boolean hasDistantChild(NAryTree child)
           
 boolean hasParent()
          DOCUMENT ME!
 boolean removeChild(NAryTree child)
          DOCUMENT ME!
 void setChildren(java.util.Set children)
          DOCUMENT ME!
 void setContents(java.lang.Object obj)
          DOCUMENT ME!
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NAryTree

public NAryTree()
Creates a new NAryTree object.


NAryTree

public NAryTree(java.lang.Object o)
Creates a new NAryTree object.

Parameters:
o - DOCUMENT ME!
Method Detail

getContents

public java.lang.Object getContents()
DOCUMENT ME!

Specified by:
getContents in interface Tree
Returns:
DOCUMENT ME!

setContents

public void setContents(java.lang.Object obj)
DOCUMENT ME!

Parameters:
obj - DOCUMENT ME!

hasChild

public boolean hasChild()
DOCUMENT ME!

Returns:
DOCUMENT ME!

hasChild

public boolean hasChild(NAryTree child)
DOCUMENT ME!

Parameters:
child - DOCUMENT ME!
Returns:
DOCUMENT ME!

getChildren

public java.util.Set getChildren()
DOCUMENT ME!

Specified by:
getChildren in interface Tree
Returns:
DOCUMENT ME!

setChildren

public void setChildren(java.util.Set children)
                 throws CircularReferenceException
DOCUMENT ME!

Parameters:
children - DOCUMENT ME!
Throws:
CircularReferenceException - DOCUMENT ME!
java.lang.IllegalArgumentException - DOCUMENT ME!

addChild

public boolean addChild(NAryTree child)
                 throws CircularReferenceException
DOCUMENT ME!

Parameters:
child - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CircularReferenceException - DOCUMENT ME!
java.lang.IllegalArgumentException - DOCUMENT ME!

removeChild

public boolean removeChild(NAryTree child)
DOCUMENT ME!

Parameters:
child - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

hasParent

public boolean hasParent()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getParent

public NAryTree getParent()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getDepth

public int getDepth()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getRoot

public NAryTree getRoot()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getRoot

public static NAryTree getRoot(NAryTree tree)
DOCUMENT ME!

Parameters:
tree - DOCUMENT ME!
Returns:
DOCUMENT ME!

getCommonRoot

public static NAryTree getCommonRoot(NAryTree tree1,
                                     NAryTree tree2)
DOCUMENT ME!

Parameters:
tree1 - DOCUMENT ME!
tree2 - DOCUMENT ME!
Returns:
DOCUMENT ME!

getLineage

public static java.util.Vector getLineage(NAryTree tree1,
                                          NAryTree tree2)
DOCUMENT ME!

Parameters:
tree1 - DOCUMENT ME!
tree2 - DOCUMENT ME!
Returns:
DOCUMENT ME!

extractNAryTree

public static NAryTree extractNAryTree(NAryTree tree1,
                                       NAryTree tree2)
DOCUMENT ME!

Parameters:
tree1 - DOCUMENT ME!
tree2 - DOCUMENT ME!
Returns:
DOCUMENT ME!

getAllChildren

public java.util.Set getAllChildren()
DOCUMENT ME!

Returns:
DOCUMENT ME!

hasDistantChild

public boolean hasDistantChild(NAryTree child)

equals

public boolean equals(java.lang.Object o)
DOCUMENT ME!

Overrides:
equals in class java.lang.Object
Parameters:
o - DOCUMENT ME!
Returns:
DOCUMENT ME!

clone

public java.lang.Object clone()
DOCUMENT ME!

Overrides:
clone in class java.lang.Object
Returns:
DOCUMENT ME!
See Also:
Object.clone()