?? userfindfilter.java
字號:
//UserFindFilter.java
import javax.microedition.rms.*;
public class UserFindFilter implements RecordFilter
{
public static final int FULLMATCH=0;//完全匹配方式
public static final int PARTMATCH=1; //部分匹配方式
protected int matchType;
protected String matchString;
protected RecordData rData;
public UserFindFilter(int mType,String mString)
{
matchType = mType;
matchString = mString;
rData = new RecordData();
}
//實現RecordFilter接口要求的函數
public boolean matches(byte[] candidate)
{
rData.ReadByte(candidate); //分解數據成為用戶信息
System.out.println("trace add name="+ rData.name);
if(matchType == FULLMATCH)
{//完全匹配方式,需要用戶姓名完全相同于指定的字符串
return 0 == rData.name.compareTo(matchString);
}
if(matchType == PARTMATCH)
{//部分匹配方式,需要用戶姓名包含指定的字符串
return -1 != rData.name.indexOf(matchString);
}
return false;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -