searchprovider.java
来自「社区文章采用的是平板、树形自由选择的两种展示方式」· Java 代码 · 共 81 行
JAVA
81 行
/*
* Created on 2007-5-26
* Last modified on 2007-11-9
* 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 + =
减小字号Ctrl + -
显示快捷键?