View Javadoc

1   package baseCode.dataStructure.tree;
2   
3   import baseCode.common.Visitable;
4   
5   /***
6    * <hr>
7    * <p>
8    * Copyright (c) 2004 Columbia University
9    * 
10   * @author pavlidis
11   * @version $Id: BinaryTreeNode.java,v 1.1 2004/07/29 08:38:49 pavlidis Exp $
12   */
13  public class BinaryTreeNode extends Visitable {
14  
15     private BinaryTreeNode left;
16     private BinaryTreeNode right;
17     private Object contents;
18  
19     /***
20      * @param left
21      * @param right
22      * @param contents
23      */
24     public BinaryTreeNode( Object contents ) {
25        super();
26        this.contents = contents;
27     }
28     
29     public BinaryTreeNode() {
30        super();
31     }
32  
33     /*
34      * (non-Javadoc)
35      * 
36      * @see java.lang.Comparable#compareTo(java.lang.Object)
37      */
38     public int compareTo( Object o ) {
39        // TODO Auto-generated method stub
40        return 0;
41     }
42  
43     /***
44      * 
45      * @return
46      */
47     public Object getContents() {
48        return contents;
49     }
50     
51     /***
52      * 
53      * @param contents
54      */
55     public void setContents( Object contents ) {
56        this.contents = contents;
57     }
58     
59     /***
60      * 
61      * @return
62      */
63     public BinaryTreeNode getLeft() {
64        return left;
65     }
66     
67     /***
68      * 
69      * @param left
70      */
71     public void setLeft( BinaryTreeNode left ) {
72        this.left = left;
73     }
74     
75     /***
76      * 
77      * @return
78      */
79     public BinaryTreeNode getRight() {
80        return right;
81     }
82     
83     /***
84      * 
85      * @param right
86      */
87     public void setRight( BinaryTreeNode right ) {
88        this.right = right;
89     }
90     
91     /***
92      * 
93      * @return
94      */
95     public boolean isLeaf() {
96        return left == null && right == null;
97     }
98  }