01: /*
02: *
03: *
04: * Portions Copyright 2000-2007 Sun Microsystems, Inc. All Rights
05: * Reserved. Use is subject to license terms.
06: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
07: *
08: * This program is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU General Public License version
10: * 2 only, as published by the Free Software Foundation.
11: *
12: * This program is distributed in the hope that it will be useful, but
13: * WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * General Public License version 2 for more details (a copy is
16: * included at /legal/license.txt).
17: *
18: * You should have received a copy of the GNU General Public License
19: * version 2 along with this work; if not, write to the Free Software
20: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21: * 02110-1301 USA
22: *
23: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
24: * Clara, CA 95054 or visit www.sun.com if you need additional
25: * information or have any questions.
26: *
27: * Copyright 2000 Motorola, Inc. All Rights Reserved.
28: * This notice does not imply publication.
29: */
30:
31: package javax.microedition.rms;
32:
33: /**
34: * An interface defining a filter which examines a record to see if it
35: * matches (based on an application-defined criteria). The
36: * application implements the match() method to select records to
37: * be returned by the RecordEnumeration. Returns true if the candidate
38: * record is selected by the RecordFilter. This interface
39: * is used in the record store for searching or subsetting records.
40: * For example:
41: * <pre>
42: * RecordFilter f = new DateRecordFilter(); // class implements RecordFilter
43: * if (f.matches(recordStore.getRecord(theRecordID)) == true)
44: * DoSomethingUseful(theRecordID);
45: * </pre>
46: *
47: * @since MIDP 1.0
48: */
49:
50: public interface RecordFilter {
51: /**
52: * Returns true if the candidate matches the implemented criterion.
53: *
54: * @param candidate the record to consider. Within this method,
55: * the application must treat this parameter as
56: * read-only.
57: *
58: * @return true if the candidate matches the implemented criterion
59: */
60: public abstract boolean matches(byte[] candidate);
61:
62: }
|