indexmanager.java
来自「一个简单的数据库」· Java 代码 · 共 65 行
JAVA
65 行
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package indexManager;import java.util.*;import database.*;import fileManager.*;/** * * @author outlaw */public class IndexManager { public static ArrayList<Index> indices=new ArrayList<Index>(); public static final int IndexSize=10; public static final int BP_SIZE=50; public IndexManager() { } public static void open() { } public static ArrayList<Index> getIndices() { return indices; } public static Index getIndex(TableData tb) { return null; } public static Index readIndexIntoMemory(String fullName) throws Exception { Index index=FileManager.readIndexIntoMemory(fullName); addIndex(index); return index; } public static void addIndex(Index index) throws Exception { rearrange(index); } public static void rearrange(int index) { indices.add(indices.remove(index)); } public static void rearrange(Index index) throws Exception { if(indices.size()>=IndexSize) { Index oldIndex=indices.get(0); if(oldIndex.isDirty()) { FileManager.writeOutIndex(index); } indices.remove(0); } indices.add(index); } public static void close() throws Exception { FileManager.writeOutIndices(); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?