01: // kelondroByteOrder.java
02: // -----------------------------
03: // (C) 2008 by Michael Peter Christen; mc@yacy.net, Frankfurt a. M., Germany
04: // first published 10.01.2008 on http://yacy.net
05: //
06: // This is a part of YaCy, a peer-to-peer based web search engine
07: //
08: // $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $
09: // $LastChangedRevision: 1986 $
10: // $LastChangedBy: orbiter $
11: //
12: // LICENSE
13: //
14: // This program is free software; you can redistribute it and/or modify
15: // it under the terms of the GNU General Public License as published by
16: // the Free Software Foundation; either version 2 of the License, or
17: // (at your option) any later version.
18: //
19: // This program is distributed in the hope that it will be useful,
20: // but WITHOUT ANY WARRANTY; without even the implied warranty of
21: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22: // GNU General Public License for more details.
23: //
24: // You should have received a copy of the GNU General Public License
25: // along with this program; if not, write to the Free Software
26: // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27:
28: package de.anomic.kelondro;
29:
30: import java.util.Comparator;
31:
32: public interface kelondroByteOrder extends kelondroOrder<byte[]> {
33:
34: public boolean wellformed(byte[] a, int start, int len);
35:
36: public int compare(byte[] a, int astart, int alen, byte[] b,
37: int bstart, int blen);
38:
39: public static class StringOrder implements Comparator<String> {
40:
41: public kelondroByteOrder baseOrder;
42:
43: public StringOrder(kelondroByteOrder base) {
44: this .baseOrder = base;
45: }
46:
47: public int compare(String s1, String s2) {
48: return baseOrder.compare(s1.getBytes(), s2.getBytes());
49: }
50:
51: }
52: }
|