KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derbyTesting > unitTests > store > QualifierUtil


1 /*
2
3    Derby - Class org.apache.derbyTesting.unitTests.store..QualifierUtil
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.derbyTesting.unitTests.store;
23
24 import org.apache.derby.iapi.store.access.Qualifier;
25
26 import org.apache.derby.iapi.types.DataValueDescriptor;
27
28 class QualifierUtil implements Qualifier
29 {
30     private int column_id;
31     private DataValueDescriptor key_val;
32     private int operator;
33     private boolean negateCompareResult;
34     private boolean orderedNulls;
35     private boolean unknownRV;
36
37     /**
38      * Constuctor
39      */

40     public QualifierUtil(
41     int column_id,
42     DataValueDescriptor key_val,
43     int operator,
44     boolean negateCompareResult,
45     boolean orderedNulls,
46     boolean unknownRV)
47     {
48         this.column_id = column_id;
49         this.key_val = key_val;
50         this.operator = operator;
51         this.negateCompareResult = negateCompareResult;
52         this.orderedNulls = orderedNulls;
53         this.unknownRV = unknownRV;
54     }
55
56     /** Qualifier interface: **/
57
58     /** Get the id of the column to be qualified. **/
59     public int getColumnId()
60     {
61         return(this.column_id);
62     }
63
64     /** Get the value that the column is to be compared to. **/
65     public DataValueDescriptor getOrderable()
66     {
67         return(this.key_val);
68     }
69
70     /** Get the operator to use in the comparison.
71      *
72      * @see DataValueDescriptor#compare
73      **/

74     public int getOperator()
75     {
76         return(this.operator);
77     }
78
79     /** Should the result of the compare be negated?
80      *
81      * @see DataValueDescriptor#compare
82      **/

83     public boolean negateCompareResult()
84     {
85         return(this.negateCompareResult);
86     }
87
88     /** Get the getOrderedNulls argument to use in the comparison.
89      *
90      * @see DataValueDescriptor#compare
91      **/

92     public boolean getOrderedNulls()
93     {
94         return(this.orderedNulls);
95     }
96
97     /** Get the getOrderedNulls argument to use in the comparison.
98      *
99      * @see DataValueDescriptor#compare
100      **/

101     public boolean getUnknownRV()
102     {
103         return(this.unknownRV);
104     }
105
106     /** Clear the DataValueDescriptor cache, if one exists.
107      * (The DataValueDescriptor can be 1 of 3 types:
108      * o VARIANT - cannot be cached as its value can
109      * vary within a scan
110      * o SCAN_INVARIANT - can be cached within a scan as its
111      * value will not change within a scan
112      * o QUERY_INVARIANT- can be cached across the life of the query
113      * as its value will never change
114      * o CONSTANT - can be cached across executions
115      *
116      * @see Qualifier#getUnknownRV
117      */

118     public void clearOrderableCache()
119     {
120         // No Orderable caching here
121
}
122
123     /**
124      * This method reinitializes all the state of
125      * the Qualifier. It is used to distinguish between
126      * resetting something that is query invariant
127      * and something that is constant over every
128      * execution of a query. Basically, clearOrderableCache()
129      * will only clear out its cache if it is a VARIANT
130      * or SCAN_INVARIANT value. However, each time a
131      * query is executed, the QUERY_INVARIANT qualifiers need
132      * to be reset.
133      */

134     public void reinitialize()
135     {
136     }
137 }
138
Popular Tags