KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > dods > cache > Condition


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  */

20 package org.enhydra.dods.cache;
21
22 /**
23  *
24  * This class stores one condition declared in WHERE part of SELECT clause.
25  *
26  * @author Tanja Jovanovic
27  * @version 2.0 15.06.2003.
28  *
29  */

30 public class Condition {
31
32     /**
33      * Column index in the table.
34      */

35     protected int columnIndex;
36     
37     /**
38      * Value to which the column DO is compared against.
39      */

40     protected Object JavaDoc value;
41     
42     /**
43      * Operator (relation) of the condition.
44      */

45      
46     protected String JavaDoc operator;
47     
48     /**
49      * Constructor (int, Object, String).
50      *
51      * @param colIndex Index of the column whose value will be compared.
52      * @param value The value to compare against.
53      * @param oper Operator.
54      */

55     public Condition(int colIndex, Object JavaDoc value, String JavaDoc oper) {
56         columnIndex = colIndex;
57         this.value = value;
58         operator = oper;
59     }
60     
61     /**
62      * Constructor (int, boolean, String).
63      *
64      * @param colIndex Index of the column whose value will be compared.
65      * @param value The boolean value to compare against.
66      * @param oper Operator.
67      */

68     public Condition(int colIndex, boolean value, String JavaDoc oper) {
69         columnIndex = colIndex;
70         this.value = new Double JavaDoc(value ? 1 : 0);
71         operator = oper;
72     }
73     
74     /**
75      * Constructor (int, double, String).
76      *
77      * @param colIndex Index of the column whose value will be compared.
78      * @param value The double value to compare against.
79      * @param oper Operator.
80      */

81     public Condition(int colIndex, double value, String JavaDoc oper) {
82         columnIndex = colIndex;
83         this.value = new Double JavaDoc(value);
84         operator = oper;
85     }
86  
87     /**
88      * Returns column index.
89      *
90      * @return Column index.
91      */

92     public int getColumnIndex() {
93         return columnIndex;
94     }
95
96     /**
97      * Returns column value.
98      *
99      * @return Column value.
100      */

101     public Object JavaDoc getValue() {
102         return value;
103     }
104
105     /**
106      * Returns operator.
107      *
108      * @return Operator.
109      */

110     public String JavaDoc getOperator() {
111         return operator;
112     }
113 }
114
Popular Tags