📄 tablenode.java
字号:
package treeandbtreedemo;
/**
* <p>Title: 表数组的元素</p>
* <p>Description。
* 表数组的元素项,包含了树节点的名称,双亲的位置,所在的层数,其兄弟的个数,在兄弟中的排行,
* 节点的x,y坐标的值 </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: </p>
* @author not liuli
* @version 1.1(2005.6.29)
* @version 2.0(2005.7.5)加入图形界面
* @version 2.1(2005.7.5)初步加入动画和线程,产生节点的遍历动画效果
* @version 2.2(2005.7.6)在基础架构中添加了二叉树类,把树和二叉树两种结构分开来做了
*/
class TableNode {
protected Object name; //树节点的名称
protected int parents; //双亲的位置
protected int ceng; //所在的层数
protected int SiblingNumbers; //兄弟的个数
protected int locate; //在兄弟中的排行
protected int x, y; //节点的x,y坐标的值
public TableNode() {}
public TableNode(Object name, int parents, int ceng) {
this.name = name;
this.parents = parents;
this.ceng = ceng;
}
public TableNode(Object name, int parents, int ceng, int SiblingNumbers,
int locate) {
this.name = name;
this.parents = parents;
this.ceng = ceng;
this.SiblingNumbers = SiblingNumbers;
this.locate = locate;
}
public TableNode(int x, int y) {
this.x = x;
this.y = y;
}
//访问
public int getX() { return x; }
public int getY() { return y; }
//修改
public void setX(int x) { this.x = x; }
public void setY(int y) { this.y = y; }
public void setXY(int x, int y) { this.x = x; this.y = y; }
//输出
public String toString() {
return name.toString() + " " + parents + " " + ceng + " " + SiblingNumbers +
" " + locate + " " + x + " " + y;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -