fr.ove.openmath.jome.model
Class Node

java.lang.Object
  extended byfr.ove.openmath.jome.model.Node
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
FormulaTreeStructure

public abstract class Node
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Definition of a N-ary tree structure.

Version:
2.0 23/06/1999
Author:
© 1999 DIRAT Laurent
See Also:
Serialized Form

Constructor Summary
Node()
          The Constructor.
 
Method Summary
 void addChild(Node child)
          Adds a child to the instance.
 void addChild(Node child, int rank)
          Adds a child to the instance.
 java.lang.Object clone()
          Clones (copies) the instance.
 void computeDepth()
          Compute the depth of the node.
 void computeNbStrahler()
          Computes the strahler number of the tree whose the instance is the root
 java.lang.Object duplicate()
          Duplicates (copies) the instance.
 Node getChild(int rank)
          Returns the child of the instance at the specified rank.
 java.util.Vector getChildren()
          Returns the list of children of the instance.
 int getDepth()
          Returns the depth of the node.
 Node getFather()
          Returns the father of the instance.
 int getNbChildren()
          Returns the number of children of the instance.
 int getNbStrahler()
          Returns the strahler number of the node.
 int getRank()
          Returns the rank of the instance in the set of its father's children
 boolean hasChild(Node node)
          Checks if the specified node is a child of the current instance.
 void moveChildren(java.util.Vector list, int rank)
          Moves the specified list of the instance children to the specified rank.
 void removeAll()
          Remove all the children of the instance.
 void removeChild(int rank)
          Removes the child of the current node at the specified rank.
 void removeChild(Node node)
          Removes the specified child of the instance.
 void setFather(Node father)
          Sets a father to instance.
 void setNbStrahler(int nbStrahler)
          Sets the Strahler number of the instance.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Node

public Node()
The Constructor.

Method Detail

getFather

public Node getFather()
Returns the father of the instance.

Returns:
the father of the node.

getRank

public int getRank()
Returns the rank of the instance in the set of its father's children

Returns:
the rank of the node.

getChild

public Node getChild(int rank)
Returns the child of the instance at the specified rank.

Parameters:
rank - the specified rank.
Returns:
the child at the specified rank.

getNbChildren

public int getNbChildren()
Returns the number of children of the instance.


getChildren

public java.util.Vector getChildren()
Returns the list of children of the instance.

Returns:
the list of children

setFather

public void setFather(Node father)
Sets a father to instance.

Parameters:
father - the father to set

addChild

public void addChild(Node child)
Adds a child to the instance.
The child added is the last of the list.

Parameters:
child - the child to add.

addChild

public void addChild(Node child,
                     int rank)
Adds a child to the instance.
The child is added at the specified rank.

Parameters:
child - the child to add.
rank - the specified rank.

removeChild

public void removeChild(int rank)
Removes the child of the current node at the specified rank.

Parameters:
rank - the rank of the child to remove.

removeChild

public void removeChild(Node node)
Removes the specified child of the instance.

Parameters:
node - the child to remove.

removeAll

public void removeAll()
Remove all the children of the instance.


moveChildren

public void moveChildren(java.util.Vector list,
                         int rank)
Moves the specified list of the instance children to the specified rank. The first child in the list has its rank setted to the specified one, the second to the first+1, ...and so on.

Parameters:
list - the list of the instance children.
rank - the specified rank.

hasChild

public boolean hasChild(Node node)
Checks if the specified node is a child of the current instance.

Parameters:
node - the specified node.
Returns:
true if the specified node is a child of the current instance. false otherwise.

clone

public java.lang.Object clone()
Clones (copies) the instance.
Make a deep clone, i.e. the children of the instance are also cloned.
Nevertheless, the father of the clone is set to null.


duplicate

public java.lang.Object duplicate()
Duplicates (copies) the instance.
The difference with clone, is a deep copy is not performed.
The father of the duplicate is set to null.


getDepth

public int getDepth()
Returns the depth of the node.


computeDepth

public void computeDepth()
Compute the depth of the node.


getNbStrahler

public int getNbStrahler()
Returns the strahler number of the node.


setNbStrahler

public void setNbStrahler(int nbStrahler)
Sets the Strahler number of the instance.
!!! ATTENTION !!! : should not be called at any time. Just specific cases only, above all, when you know what you are doing.

Parameters:
nbStrahler - the Strahler number value to set.

computeNbStrahler

public void computeNbStrahler()
Computes the strahler number of the tree whose the instance is the root



Copyright © 1999-2007 Universit?© de Nice Sophia-Antipolis, I3S, Ove SARL, DFKI and Universit?§t des Saarlandes. All Rights Reserved.