亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? btreepage.java

?? 用java語言簡單實現數據庫的初步功能
?? JAVA
字號:
package simpledb.index.btree;import static simpledb.sql.Types.INTEGER;import static simpledb.file.Page.*;import simpledb.file.Block;import simpledb.record.*;import simpledb.query.*;import simpledb.tx.Transaction;/** * B-tree directory and leaf pages have many commonalities: * in particular, their records are stored in sorted order,  * and pages split when full. * A BTreePage object contains this common functionality. * @author Edward Sciore */public class BTreePage {	private Block currentblk;	private TableInfo ti;	private Transaction tx;	private int slotsize;	/**	 * Opens a page for the specified B-tree block.	 * @param currentblk a reference to the B-tree block	 * @param ti the metadata for the particular B-tree file	 * @param tx the calling transaction	 */	public BTreePage(Block currentblk, TableInfo ti, Transaction tx) {		this.currentblk = currentblk;		this.ti = ti;		this.tx = tx;		slotsize = ti.recordLength();		tx.pin(currentblk);	}	/**	 * Calculates the position where the first record having	 * the specified search key should be, then returns	 * the position before it.	 * @param searchkey the search key	 * @return the position before where the search key goes	 */	public int findSlotBefore(Constant searchkey) {		int slot = 0;		while (slot < getNumRecs() && getDataVal(slot).compareTo(searchkey) < 0)			slot++;		return slot-1;	}	/**	 * Closes the page by unpinning its buffer.	 */	public void close() {		if (currentblk != null)			tx.unpin(currentblk);		currentblk = null;	}	/**	 * Returns true if the block is full.	 * @return true if the block is full	 */	public boolean isFull() {		return slotpos(getNumRecs()+1) >= BLOCK_SIZE;	}	/**	 * Splits the page.	 * The split value is the value of the middle record.	 * Those records having values at least as high as the	 * split value are moved into the specified page.	 * @param dest the destination page	 * @return the split value	 */	public Constant split(BTreePage dest) {		int splitslot = getNumRecs() / 2;		Constant splitval = getDataVal(splitslot);		if (!splitval.equals(getDataVal(0))) {			//go to first occurrence of splitval			while (splitval.equals(getDataVal(splitslot-1)))				splitslot--;		}		transferRecs(splitslot, dest);		return splitval;	}	/**	 * Returns the dataval of the record at the specified slot.	 * @param slot the integer slot of an index record	 * @return the dataval of the record at that slot	 */	public Constant getDataVal(int slot) {		return getVal(slot, "dataval");	}	/**	 * Returns the value of the page's flag field	 * @return the value of the page's flag field	 */	public int getFlag() {		return tx.getInt(currentblk, 0);	}	/**	 * Sets the page's flag field to the specified value	 * @param val the new value of the page flag	 */	public void setFlag(int val) {		tx.setInt(currentblk, 0, val);	}	/**	 * Appends a new block to the end of the specified B-tree file,	 * having the specified flag value.	 * @param filename the name of the file	 * @param flag the initial value of the flag	 * @return a reference to the newly-created block	 */	public Block appendNew(String filename, int flag) {		return tx.append(filename, new BTPageFormatter(ti, flag));	}	// Methods called only by BTreeDir	/**	 * Returns the block number stored in the index record 	 * at the specified slot.	 * @param slot the slot of an index record	 * @return the block number stored in that record	 */	public int getChildNum(int slot) {		return getInt(slot, "block");	}	/**	 * Inserts a directory entry at the specified slot.	 * @param slot the slot of an index record	 * @param val the dataval to be stored	 * @param blknum the block number to be stored	 */	public void insertDir(int slot, Constant val, int blknum) {		insert(slot);		setVal(slot, "dataval", val);		setInt(slot, "block", blknum);	}	/**	 * Moves all of the records from this block to the 	 * specified one.	 * This method is called when a new root is created.	 * @param blk the destination block	 */	public void moveTo(Block blk) {		BTreePage newpage = new BTreePage(blk, ti, tx);		transferRecs(0, newpage);		newpage.close();	}	// Methods called only by BTreeLeaf	/**	 * Returns the dataRID value stored in the specified leaf index record.	 * @param slot the slot of the desired index record	 * @return the dataRID value store at that slot	 */	public RID getDataRid(int slot) {		return new RID(getInt(slot, "block"), getInt(slot, "id"));	}	/**	 * Inserts a leaf index record at the specified slot.	 * @param slot the slot of the desired index record	 * @param val the new dataval	 * @param rid the new dataRID	 */	public void insertLeaf(int slot, Constant val, RID rid) {		insert(slot);		setVal(slot, "dataval", val);		setInt(slot, "block", rid.blockNumber());		setInt(slot, "id", rid.id());	}	/**	 * Deletes the index record at the specified slot.	 * @param slot the slot of the deleted index record	 */	public void delete(int slot) {		for (int i=slot+1; i<getNumRecs(); i++)			copyRecord(i, i-1);		setNumRecs(getNumRecs()-1);		return;	}	/**	 * Returns the number of index records in this page.	 * @return the number of index records in this page	 */	public int getNumRecs() {		return tx.getInt(currentblk, INT_SIZE);	}	// Private methods	private int getInt(int slot, String fldname) {		int pos = fldpos(slot, fldname);		return tx.getInt(currentblk, pos);	}	private String getString(int slot, String fldname) {		int pos = fldpos(slot, fldname);		return tx.getString(currentblk, pos);	}	private Constant getVal(int slot, String fldname) {		int type = ti.schema().type(fldname);		if (type == INTEGER)			return new IntConstant(getInt(slot, fldname));		else			return new StringConstant(getString(slot, fldname));	}	private void setInt(int slot, String fldname, int val) {		int pos = fldpos(slot, fldname);		tx.setInt(currentblk, pos, val);	}	private void setString(int slot, String fldname, String val) {		int pos = fldpos(slot, fldname);		tx.setString(currentblk, pos, val);	}	private void setVal(int slot, String fldname, Constant val) {		int type = ti.schema().type(fldname);		if (type == INTEGER)			setInt(slot, fldname, (Integer)val.asJavaVal());		else			setString(slot, fldname, (String)val.asJavaVal());	}	private void setNumRecs(int n) {		tx.setInt(currentblk, INT_SIZE, n);	}	private void insert(int slot) {		for (int i=getNumRecs(); i>slot; i--)			copyRecord(i-1, i);		setNumRecs(getNumRecs()+1);	}	private void copyRecord(int from, int to) {		Schema sch = ti.schema();		for (String fldname : sch.fields())			setVal(to, fldname, getVal(from, fldname));	}	private void transferRecs(int slot, BTreePage dest) {		int destslot = 0;		while (slot < getNumRecs()) {			dest.insert(destslot);			Schema sch = ti.schema();			for (String fldname : sch.fields())				dest.setVal(destslot, fldname, getVal(slot, fldname));			delete(slot);			destslot++;		}	}	private int fldpos(int slot, String fldname) {		int offset = ti.offset(fldname);		return slotpos(slot) + offset;	}	private int slotpos(int slot) {		return INT_SIZE + INT_SIZE + (slot * slotsize);	}}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
懂色av噜噜一区二区三区av | 激情丁香综合五月| 亚洲欧美国产77777| 中文字幕欧美激情| 亚洲一区二区三区三| 亚洲欧洲精品成人久久奇米网| 久久久精品人体av艺术| 久久久天堂av| 中文字幕va一区二区三区| 国产精品私人自拍| 国产精品日韩成人| 有坂深雪av一区二区精品| 亚洲日本在线观看| 亚洲美女偷拍久久| 亚洲成av人影院| 香蕉av福利精品导航| 蜜臀av性久久久久蜜臀aⅴ流畅 | 久久精品国产亚洲一区二区三区| 午夜精品成人在线视频| 久久国产夜色精品鲁鲁99| 狠狠久久亚洲欧美| 成人高清av在线| 日本久久电影网| 日韩一区二区三区观看| 精品国产一区二区精华| 国产精品美女久久久久久久网站| 一区二区三区.www| 蜜臀av性久久久久蜜臀av麻豆| 国产一二精品视频| av成人免费在线| 欧美一级久久久久久久大片| 久久无码av三级| 亚洲专区一二三| 国产一区二区久久| 在线亚洲欧美专区二区| 91精品一区二区三区久久久久久| ww亚洲ww在线观看国产| 亚洲精品国久久99热| 秋霞影院一区二区| 99国产精品久| 欧美一区二区视频在线观看2022 | 成人一区二区视频| 欧美日韩国产乱码电影| 国产日韩欧美精品一区| 午夜视黄欧洲亚洲| 99久久精品免费看国产| 日韩欧美精品在线| 亚洲精品久久久蜜桃| 国产伦精一区二区三区| 欧美日韩在线观看一区二区 | 日本一区二区三区高清不卡| 国产精品久久久久国产精品日日| 日韩av网站在线观看| 色琪琪一区二区三区亚洲区| 国产午夜亚洲精品午夜鲁丝片| 亚洲成人黄色小说| 色综合久久久久综合体桃花网| 欧美大片顶级少妇| 日韩av一二三| 欧美久久久久中文字幕| 亚洲欧美在线视频| 国产jizzjizz一区二区| 欧美一区二区免费观在线| 亚洲最快最全在线视频| a级高清视频欧美日韩| 国产网站一区二区| 国产在线精品不卡| www国产精品av| 狠狠网亚洲精品| 日韩免费看网站| 六月丁香婷婷色狠狠久久| 欧美麻豆精品久久久久久| 亚洲一区日韩精品中文字幕| 色婷婷av一区| 亚洲国产美女搞黄色| 欧美三级蜜桃2在线观看| 亚洲影院理伦片| 欧美二区三区的天堂| 亚洲成人免费在线| 91精品国产综合久久久久久久| 亚洲国产一二三| 欧美色老头old∨ideo| 亚洲成av人片| 91精品国产品国语在线不卡| 轻轻草成人在线| 精品理论电影在线| 国产麻豆欧美日韩一区| 日本一区二区三区在线观看| eeuss鲁一区二区三区| 亚洲欧美福利一区二区| 欧美日韩精品一区视频| 免费一级片91| 国产日韩精品一区二区三区在线| 成人精品鲁一区一区二区| 国产精品污网站| 欧美影院一区二区三区| 日韩国产在线观看| 精品国产乱码久久久久久1区2区| 国产精品中文欧美| 亚洲另类一区二区| 91精品在线麻豆| 成人免费毛片高清视频| 亚洲综合色婷婷| 久久综合999| 色婷婷一区二区| 国产自产2019最新不卡| 国产精品理论片在线观看| 91福利国产精品| 国模套图日韩精品一区二区| 国产精品第四页| 欧美精品国产精品| 成人免费高清视频在线观看| 亚洲一区二区欧美| 久久久www成人免费毛片麻豆| 色婷婷久久久综合中文字幕| 免费的国产精品| 亚洲免费观看高清完整版在线观看| 欧美狂野另类xxxxoooo| 成人毛片在线观看| 日本一区中文字幕| 中文字幕一区在线观看视频| 日韩欧美国产一区在线观看| 色天使色偷偷av一区二区| 久久国产精品色婷婷| 亚洲一区二区三区四区五区中文| 欧美一区二区三区系列电影| 91热门视频在线观看| 韩国精品一区二区| 丝袜诱惑制服诱惑色一区在线观看 | 美洲天堂一区二卡三卡四卡视频| 中文字幕在线不卡国产视频| 日韩欧美一级精品久久| 欧美午夜精品理论片a级按摩| 成人激情动漫在线观看| 国内成人自拍视频| 蜜臀va亚洲va欧美va天堂| 亚洲专区一二三| 1000部国产精品成人观看| 久久综合久久99| 欧美tickling挠脚心丨vk| 欧美色综合网站| 91老师国产黑色丝袜在线| 岛国精品在线观看| 国内精品久久久久影院色| 五月婷婷激情综合| 亚洲资源在线观看| 一区二区三区在线视频观看58| 国产嫩草影院久久久久| 亚洲精品在线三区| 精品日韩欧美一区二区| 欧美一区二区三区免费| 欧美日韩一二三区| 欧美丰满嫩嫩电影| 欧美三区在线观看| 欧美日韩国产首页在线观看| 精品视频色一区| 欧美日韩成人高清| 欧美日韩一级二级| 56国语精品自产拍在线观看| 制服丝袜中文字幕亚洲| 欧美一区二区久久| 欧美一区二区网站| 久久精品夜夜夜夜久久| 欧美国产精品一区二区| 久久久久久久久久久久电影| 日韩精品专区在线影院观看| 欧美mv日韩mv国产网站app| 日韩视频在线观看一区二区| 精品粉嫩超白一线天av| 国产精品无遮挡| 一区二区三区成人| 视频一区中文字幕国产| 麻豆国产精品一区二区三区| 久久99九九99精品| 蜜桃视频免费观看一区| 国产精品一区二区在线播放| 本田岬高潮一区二区三区| 欧美性生交片4| 欧美一区二区观看视频| 久久女同精品一区二区| 日韩理论电影院| 美腿丝袜亚洲一区| 成人午夜激情在线| 欧美日韩国产中文| 久久久久国产免费免费| 亚洲美女视频在线观看| 免费观看日韩av| 99麻豆久久久国产精品免费 | 亚洲h动漫在线| 九九热在线视频观看这里只有精品| 国产一区二区三区精品欧美日韩一区二区三区 | 亚洲欧洲av色图| 日韩电影免费在线| bt7086福利一区国产| 欧美一区二区三区小说| 日韩伦理免费电影| 韩国三级在线一区| 91久久精品网| 国产亚洲午夜高清国产拍精品 | 欧美吞精做爰啪啪高潮|