⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 indexselectplan.java

📁 用java语言简单实现数据库的初步功能
💻 JAVA
字号:
package simpledb.index.query;import simpledb.tx.Transaction;import simpledb.record.Schema;import simpledb.query.*;import simpledb.index.Index;import simpledb.index.metadata.IndexInfo;/** The Plan class corresponding to the <i>indexselect</i> * relational algebra operator. * @author Edward Sciore */public class IndexSelectPlan implements Plan {	private IndexInfo ii;	private Constant val;		/**	 * Creates a new indexselect node in the query tree	 * for the specified index and selection constant.	 * @param ii information about the index	 * @param val the selection constant	 * @param tx the calling transaction 	 */	public IndexSelectPlan(IndexInfo ii, Constant val, Transaction tx) {		this.ii = ii;		this.val = val;	}	/** 	 * Creates a new indexselect scan for this query	 * @see simpledb.query.Plan#open()	 */	public Scan open() {		Index idx = ii.open();		return new IndexSelectScan(idx, val);	}	/**	 * Estimates the number of block accesses to compute the 	 * index selection, which is the same as the 	 * index traversal cost.	 * @see simpledb.query.Plan#blocksAccessed()	 */	public int blocksAccessed() {		return ii.blocksAccessed();	}	/**	 * Estimates the number of output records in the index selection,	 * which is the same as the number of search key values	 * for the index.	 * @see simpledb.query.Plan#recordsOutput()	 */	public int recordsOutput() {		return ii.recordsOutput();	}	/** 	 * This method should never be called,	 * because there are no interesting fields in the index.	 * @see simpledb.query.Plan#distinctValues(java.lang.String)	 */	public int distinctValues(String fname) {		throw new RuntimeException("field " + fname + " not found.");	}	/**	 * Returns an empty schema, because there are no	 * interesting fields in the index.	 * @see simpledb.query.Plan#schema()	 */	public Schema schema() {		return new Schema();  // i.e. return an empty schema	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -