testnode.java
来自「自己上学时写的Btree算法」· Java 代码 · 共 47 行
JAVA
47 行
/*
* TestNode.java
*
*/
import java.util.Vector;
import java.util.Collections;
/**
*
* @author Kun Fang
*/
public class TestNode {
private Vector<Entry> nodeEntries; //stored entries in the node
private Vector<TestNode> children; //pointers to the children nodes
/** Creates a new instance of TestNode */
public TestNode(int k) {
this.nodeEntries = new Vector<Entry>(2*k);
this.children = new Vector<TestNode>(2*k+1);
}
public void addEntry(Entry e) {
nodeEntries.add(e);
}
public void addChild(TestNode b) {
children.add(b);
}
public Vector<Entry> getEntries() {
return this.nodeEntries;
}
public String entriesToString() {
String r = new String();
for(int i=0;i<nodeEntries.size();i++) {
r = r + nodeEntries.elementAt(i).getKey();
}
return r;
}
public Vector<TestNode> getChildren() {
return this.children;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?