index.java

来自「java实现的全文搜索引擎」· Java 代码 · 共 74 行

JAVA
74
字号
/**
 * 
 */
package cn.edu.nju.software.ruse;

import java.io.File;
import java.io.Serializable;
import java.util.HashMap;
import java.util.HashSet;
import java.util.HashSet;

/**
 * @author spring
 *
 */
public class Index implements Serializable {

	/**
	 * Hold the index about modTime
	 */
	private HashMap<String, HashSet<File>> modTimeIndex = new HashMap<String, HashSet<File>>();
	
	/**
	 * Hold the index about fileSize
	 */
	private HashMap<Long, HashSet<File>> fileSizeIndex = new HashMap<Long, HashSet<File>>();
	
	/**
	 * Hold the index about fileName
	 */
	private File[] fileNameIndex;
	
	/**
	 * Hold the index about fileContents, where HashMap indicates every word's
	 * position in each file.
	 */
	private HashMap<String, HashMap<File,HashSet<Integer>>> fileContentsIndex = new HashMap<String, HashMap<File,HashSet<Integer>>>();

	public HashMap<String, HashSet<File>> getModTimeIndex() {
		return modTimeIndex;
	}

	public void setModTimeIndex(HashMap<String, HashSet<File>> modTimeIndex) {
		this.modTimeIndex = modTimeIndex;
	}

	public HashMap<Long, HashSet<File>> getFileSizeIndex() {
		return fileSizeIndex;
	}

	public void setFileSizeIndex(HashMap<Long, HashSet<File>> fileSizeIndex) {
		this.fileSizeIndex = fileSizeIndex;
	}

	public HashMap<String, HashMap<File, HashSet<Integer>>> getFileContentsIndex() {
		return fileContentsIndex;
	}

	public void setFileContentsIndex(
			HashMap<String, HashMap<File, HashSet<Integer>>> fileContentsIndex) {
		this.fileContentsIndex = fileContentsIndex;
	}

	public File[] getFileNameIndex() {
		return fileNameIndex;
	}

	public void setFileNameIndex(File[] fileNameIndex) {
		this.fileNameIndex = fileNameIndex;
	}
	
	
}

⌨️ 快捷键说明

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