/** * Programming Assignment #4 * *
 * BSTnode
 * 
* * @author s2251 */ import java.lang.*; public class BSTNode implements Comparable{ private Object data; private BSTNode rightchild; private BSTNode leftchild; public BSTNode(){} public BSTNode(Object dat){ setData(dat); setrightchild(null); setleftchild(null); } //accessors and modifiers public void setData(Object dat){ data = (Comparable) dat; } public Comparable getData(){ return (Comparable) data; } public void setrightchild(BSTNode right){ this.rightchild = right; } public BSTNode getrightchild(){ return this.rightchild; } public void setleftchild(BSTNode left){ this.leftchild = left; } public BSTNode getleftchild(){ return this.leftchild; } //compareTo which implements compareTo in java.lang.* public int compareTo(Object a){ BSTNode mine = (BSTNode) a; return(this.getData().compareTo(mine.getData())); } public static void main(String argv[]){ BSTNode test = new BSTNode(); } }