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

📄 searchprovider.java

📁 野蔷薇论坛源码 java 自己看看吧。 学习用
💻 JAVA
字号:
/* 
 * Created on 2007-5-26
 * Last modified on 2007-9-29
 * Powered by GamVan.com
 */
package com.yeqiangwei.club.service.search;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public abstract class SearchProvider<Model> {
	
	public static final int SEARCH_TOPIC = 1;
	
	public static final int SEARCH_USER= 2;
	
	protected int totalrows = 0;
	
	protected long runtimed = 0;	
	
	public static Map<Integer, Double> PROGRESS; //大致的进度 
	
	static{
		if(PROGRESS==null)PROGRESS = new HashMap<Integer, Double>();
	}
	
	public static int STATE = 0; //0停止  1执行中  2完成
	
	/**
	 * 
	 * @param iscreate 创建还是追加
	 */
	public abstract void createIndex(boolean iscreate, int minId);
	
	/*
	 * 1为自动判断是创建还是追加  0为强制重新生成
	 */
	public abstract void createIndex(int auto);
	
	public abstract void deleteIndex(int id);
	
	public abstract void updateIndex(int id);
	
	public abstract List<Model> results(SearchParameter param);
	
	public abstract int getTotalrows();

	public abstract void setTotalrows(int totalrows);

	public abstract long getRuntimed() ;
	
	public static void setProgress(int type, int total, int indexed){
		if(total==0){
			PROGRESS.put(type,new Double(0));
			return;
		}
		Double z = new Double(indexed);
		Double m = new Double(total);
		PROGRESS.put(type,(z/m));
	}
	
	public static void setProgress(int type, long total, int indexed){
		if(total==0){
			PROGRESS.put(type,new Double(0));
			return;
		}
		Double z = new Double(indexed);
		Double m = new Double(total);
		PROGRESS.put(type,(z/m));
	}
	
	public static Double getProgress(int type){
		Double i = PROGRESS.get(type);
		if(i==null){
			return new Double(0);
		}
		return i;
	}
}

⌨️ 快捷键说明

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