operator_not.java

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

JAVA
39
字号
/**
 * Decorator Pattern
 */
package cn.edu.nju.software.ruse;

import java.io.File;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;

/**
 * @author spring
 *
 */
public class Operator_NOT extends Operator {

	/* (non-Javadoc)
	 * @see main.Operand#getPRI()
	 */
	public Operator_NOT() {
		desription = "NOT";
		PRI = PRI_NOT;
	}
	public int getPRI() {
		return PRI;
	}
	public HashSet<File> not(HashSet<File> x, Index index) {
//System.err.println("@Operator_NOT Doing the NOT operator.");
		File[] f = index.getFileNameIndex();
		HashSet<File> temp = new HashSet<File>();
		for(File item: f) {
			temp.add(item);
		}
		temp.removeAll(x);
		return temp;
	}

}

⌨️ 快捷键说明

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