public interface NodeType {
public static final byte LEAF = 0;
public static final byte INNER = 1;
}
public abstract class Node implements NodeType {
protected byte type;//node type
protected long id; //node id
protected int num; //number of keys
protected double[] keys = null;//new Key[M/N];
private static long lastId = 0;
public static synchronized long getNextId() {
return ++lastId;
}
public static long getLastId() {
return lastId;
}
public long getId(){
return id;
}
/**
* leaf node always with height to be 0, so LNode don't need to override it
*/
public int getHeight(){
return 0;
}
}
public class ResultList{
public ResultNode header;
private int l;
public ResultList(){
header = new ResultNode();
}
public ResultList(ResultNode n){
header = n;
}
public int length(){
return l;
}
public void inc(){
l++;
}
}
public class ResultNode{
public double[] p;
public double k;
public ResultNode next;
public ResultNode(){
p = null;
k = 0;
next = null;
}
public ResultNode(double k, double[] p){
this(k, p, null);
}
public ResultNode(double k, double[] p, ResultNode n){
this.k = k;
this.p = p;
this.next = n;
}
}
posted on 2007-10-17 15:25
Fay 阅读(79)
评论(0) 编辑 收藏