KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ldap > server > db > TupleComparator


1 /*
2  * Copyright 2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17 package org.apache.ldap.server.db;
18
19
20 import org.apache.ldap.server.schema.SerializableComparator;
21
22 import java.io.Serializable JavaDoc;
23
24
25 /**
26  * Used to compare the sorting order of binary data.
27  *
28  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
29  * @version $Rev: 169198 $
30  */

31 public interface TupleComparator extends Serializable JavaDoc
32 {
33     /**
34      * Gets the comparator used to compare keys. May be null in which
35      * case the compareKey method will throw an UnsupportedOperationException.
36      *
37      * @return the comparator for comparing keys.
38      */

39     SerializableComparator getKeyComparator();
40
41
42     /**
43      * Gets the binary comparator used to compare valuess. May be null in which
44      * case the compareValue method will throw an UnsupportedOperationException.
45      *
46      * @return the binary comparator for comparing values.
47      */

48     SerializableComparator getValueComparator();
49
50
51     /**
52      * Compares key Object to determine their sorting order returning a
53      * value = to, < or > than 0.
54      *
55      * @param key1 the first key to compare
56      * @param key2 the other key to compare to the first
57      * @return 0 if both are equal, a negative value less than 0 if the first
58      * is less than the second, or a postive value if the first is greater than
59      * the second byte array.
60      */

61     int compareKey( Object JavaDoc key1, Object JavaDoc key2 );
62
63
64     /**
65      * Comparse value Objects to determine their sorting order returning a
66      * value = to, < or > than 0.
67      *
68      * @param value1 the first value to compare
69      * @param value2 the other value to compare to the first
70      * @return 0 if both are equal, a negative value less than 0 if the first
71      * is less than the second, or a postive value if the first is greater than
72      * the second Object.
73      */

74     int compareValue( Object JavaDoc value1, Object JavaDoc value2 );
75 }
76
Popular Tags