01: /*
02:
03: Derby - Class org.apache.derby.iapi.store.access.BinaryOrderable
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to you under the Apache License, Version 2.0
09: (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;
29: import java.io.IOException;
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: * Compare this Orderable with a given Orderable for the purpose of
51: * index positioning. This method treats nulls as ordered values -
52: * that is, it treats SQL null as equal to null and less than all
53: * other values.
54: *
55: * @param other The Orderable to compare this one to.
56: *
57: * @return <0 - this Orderable is less than other.
58: * 0 - this Orderable equals other.
59: * >0 - this Orderable is greater than other.
60: *
61: * The code should not explicitly look for -1, or 1.
62: *
63: * @exception IOException Thrown on error
64: */
65: int binarycompare(ObjectInput in, Orderable other)
66: throws IOException;
67:
68: /**
69: * Compare this Orderable with a given Orderable for the purpose of
70: * qualification and sorting. The caller gets to determine how nulls
71: * should be treated - they can either be ordered values or unknown
72: * values.
73: *
74: * @param op Orderable.ORDER_OP_EQUALS means do an = comparison.
75: * Orderable.ORDER_OP_LESSTHAN means compare this < other.
76: * Orderable.ORDER_OP_LESSOREQUALS means compare this <= other.
77: * @param other The Orderable to compare this one to.
78: * @param orderedNulls True means to treat nulls as ordered values,
79: * that is, treat SQL null as equal to null, and less
80: * than all other values.
81: * False means to treat nulls as unknown values,
82: * that is, the result of any comparison with a null
83: * is the UNKNOWN truth value.
84: * @param unknownRV The return value to use if the result of the
85: * comparison is the UNKNOWN truth value. In other
86: * words, if orderedNulls is false, and a null is
87: * involved in the comparison, return unknownRV.
88: * This parameter is not used orderedNulls is true.
89: *
90: * @return true if the comparison is true.
91: *
92: * @exception IOException Thrown on error
93: */
94: boolean binarycompare(ObjectInput in, int op, Orderable other,
95: boolean orderedNulls, boolean unknownRV) throws IOException;
96: }
|