📄 mysearcher.java
字号:
/**
* Strategy Pattern
*/
package cn.edu.nju.software.ruse;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.HashSet;
/**
* @author spring
*
*/
public class MySearcher extends SearchFiles {
RUSE ruse;
/**
*Hold the index.
*/
//private Map<String,HashSet<File>> hm;
private Index index;
@SuppressWarnings("unchecked")
public MySearcher(String indexPlace) {
/**
* Read index from disk to memory.
* */
//System.err.println("@MySearcher Read index from disk to memory.");
try {
ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(new FileInputStream(indexPlace + "\\index.dat")));
this.index = (Index) ois.readObject();
ois.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//System.err.println("@MySearcher Read successfully.");
this.parser = new OperatorParser(index);
}
public HashSet<File> getResult() {
return ((OperatorParser)this.parser).getResult();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -