treenode.java~2~

来自「源程序(包括最初的版本」· JAVA~2~ 代码 · 共 49 行

JAVA~2~
49
字号
package App;/** * <p>Title: 树节点</p> * <p>Description: 把二叉树与树整合在一起,包括节点元素,左小孩,右兄弟</p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author not liuli * @version 1.1(2005.6.29) */public class TreeNode {  Object element;  TreeNode firstChild;//左小孩  TreeNode nextSibling;//右兄弟  //构造方法  public TreeNode() {}  public TreeNode(Object theElement) { element=theElement; }  public TreeNode(Object theElement,TreeNode theFirstChild,TreeNode theNextSibling){        element=theElement;        firstChild=theFirstChild;        nextSibling=theNextSibling;  }  // 访问性方法  public TreeNode getFirstChild() {return firstChild;}  public TreeNode getNextSibling() {return nextSibling;}  public Object getElement() {return element;}  // 针对数据成员的变异性方法  public void setLeftChild(TreeNode theFirstChild){      firstChild=theFirstChild;  }  public void setRightChild(TreeNode theNextSibling){      nextSibling=theNextSibling;  }  public void setElement(Object theElement){      element = theElement;  }  // 输出数据元素方法  public String toString() {      return element.toString();  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?