📄 noderelation.java
字号:
/* * Created on Jun 9, 2004 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */package com.nay0648.ds.bplustree;import java.util.*;/** * Description:<br> *    this class is used to deal with the relationship between node * such as get a node's parent,get a node's brother and so on.here use an * List hold the node's address need to deal with,because the limit of the * memory,so here cache a node's address instead of cache a node.the node * into this class must added in order. * @abstract * @keywords * @author nay0648<br> * if you have any questions,advices,suggests,or find any * bugs,please mail me: <a href="mailto:">nay0648@sina.com</a> * @version last modified:Jun 9, 2004 */class NodeRelation{private List relation; public NodeRelation() { relation=new ArrayList(); } /** * add a node into the relation list * @param addr * the node's address */ public void addNode(long addr) { relation.add(new Long(addr)); } /** * get a node's parent node's address,exectaly,it's * get the predecessor address of argument address,in * relationship list * @param addr * a node's address * @return * return BPlusTree.NULL if this node dose not have parent */ public long getParent(long addr) { int i; for(i=0;i<relation.size();i++) if(((Long)relation.get(i)).longValue()==addr) break; if(i==0) return BPlusTree.NULL; else return ((Long)relation.get(i-1)).longValue(); } public String toString() { return relation.toString(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -