Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

Tree.java

00001 package gov.nasa.arc.ase.util;
00002 
00003 //#ifdef JDK11
00004 
00005 //#else JDK11
00006 import java.util.Collection;
00007 //#endif JDK11
00008 
00009 /**
00010  * This class represents a tree.
00011  */
00012 public class Tree {
00013   /**
00014    * The root of the tree.
00015    */
00016   private TreeNode root;
00017 
00018   /**
00019    * Creates a new tree with no nodes.
00020    */
00021   public Tree() {
00022     root = null;
00023   }  
00024   /**
00025    * Gets all the node equal to a given one.
00026    */
00027   public Collection get(TreeNode n) {
00028     return root.get(n);
00029   }  
00030   /**
00031    * Returns the root of the tree.
00032    */
00033   public TreeNode getRoot() {
00034     return root;
00035   }  
00036   /**
00037    * Sets a new root.
00038    */
00039   void setRoot(TreeNode r) {
00040     root = r;
00041   }  
00042   /**
00043    * Returns a string rapresentation of the tree.
00044    */
00045   public String toString() {
00046     if(root == null) return "-";
00047 
00048     return "\\" + root.toString("   ");
00049   }  
00050 }

Generated at Thu Feb 7 06:58:06 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001