KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > store > access > BinaryOrderable


1 /*
2
3    Derby - Class org.apache.derby.iapi.store.access.BinaryOrderable
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.iapi.store.access;
23
24 import org.apache.derby.iapi.types.Orderable;
25
26 import org.apache.derby.iapi.error.StandardException;
27
28 import java.io.ObjectInput JavaDoc;
29 import java.io.IOException JavaDoc;
30
31 /**
32
33   The Orderable interface represents a value that can
34   be linearly ordered.
35   <P>
36   Currently only supports linear (<, =, <=) operations.
37   Eventually we may want to do other types of orderings,
38   in which case there would probably be a number of interfaces
39   for each "class" of ordering.
40   <P>
41   The implementation must handle the comparison of null
42   values. This may require some changes to the interface,
43   since (at least in some contexts) comparing a value with
44   null should return unknown instead of true or false.
45
46 **/

47
48 public interface BinaryOrderable extends Orderable
49 {
50     /**
51      * Compare this Orderable with a given Orderable for the purpose of
52      * index positioning. This method treats nulls as ordered values -
53      * that is, it treats SQL null as equal to null and less than all
54      * other values.
55      *
56      * @param other The Orderable to compare this one to.
57      *
58      * @return <0 - this Orderable is less than other.
59      * 0 - this Orderable equals other.
60      * >0 - this Orderable is greater than other.
61      *
62      * The code should not explicitly look for -1, or 1.
63      *
64      * @exception IOException Thrown on error
65      */

66     int binarycompare(
67     ObjectInput JavaDoc in,
68     Orderable other)
69         throws IOException JavaDoc;
70
71     /**
72      * Compare this Orderable with a given Orderable for the purpose of
73      * qualification and sorting. The caller gets to determine how nulls
74      * should be treated - they can either be ordered values or unknown
75      * values.
76      *
77      * @param op Orderable.ORDER_OP_EQUALS means do an = comparison.
78      * Orderable.ORDER_OP_LESSTHAN means compare this < other.
79      * Orderable.ORDER_OP_LESSOREQUALS means compare this <= other.
80      * @param other The Orderable to compare this one to.
81      * @param orderedNulls True means to treat nulls as ordered values,
82      * that is, treat SQL null as equal to null, and less
83      * than all other values.
84      * False means to treat nulls as unknown values,
85      * that is, the result of any comparison with a null
86      * is the UNKNOWN truth value.
87      * @param unknownRV The return value to use if the result of the
88      * comparison is the UNKNOWN truth value. In other
89      * words, if orderedNulls is false, and a null is
90      * involved in the comparison, return unknownRV.
91      * This parameter is not used orderedNulls is true.
92      *
93      * @return true if the comparison is true.
94      *
95      * @exception IOException Thrown on error
96      */

97     boolean binarycompare(
98     ObjectInput JavaDoc in,
99     int op,
100     Orderable other,
101     boolean orderedNulls,
102     boolean unknownRV)
103                 throws IOException JavaDoc;
104 }
105
Popular Tags