?? simplefilter.java
字號:
/* * Copyright (c) 2000-2001 Sun Microsystems, Inc. All Rights Reserved. */package examples.addressbook;import java.lang.*;import java.io.*;import java.util.*;import javax.microedition.rms.*;/** * This class implements the RecordFilter interface. * It works on the records created by SimpleRecord. * It filters on first name and/or last name. */public class SimpleFilter implements RecordFilter { // first and last names on which to filter private String first; private String last; /** * Public constructor: stores the first and last * names on which to filter. Stores first/last * names as lower case so that filters are * are case-insensitive. */ public SimpleFilter(String f, String l) { first = f.toLowerCase(); last = l.toLowerCase(); } /** * Takes a record, (r), and checks to see if it matches * the first and last name set in our constructor. * * Extracts the first and last names from the record, * converts them to lower case, then compares them * with the values extracted from the record. * * return true if record matches, false otherwise */ public boolean matches(byte[] r) { String f = SimpleRecord.getFirstName(r).toLowerCase(); String l = SimpleRecord.getLastName(r).toLowerCase(); return f.startsWith(first) && l.startsWith(last); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -