1 /*
2 QueryJ
3
4 Copyright (C) 2002 Jose San Leandro Armend?riz
5 jsanleandro@yahoo.es
6 chousz@yahoo.com
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
17
18 You should have received a copy of the GNU General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
22 Thanks to ACM S.L. for distributing this library under the GPL license.
23 Contact info: jsanleandro@yahoo.es
24 Postal Address: c/Playa de Lagoa, 1
25 Urb. Valdecaba?as
26 Boadilla del monte
27 28660 Madrid
28 Spain
29
30 ******************************************************************************
31 *
32 * Filename: $RCSfile: ConditionOperator.java,v $
33 *
34 * Author: Jose San Leandro Armend?riz
35 *
36 * Description: Represents conditions in SQL statements.
37 *
38 * Last modified by: $Author: chous $ at $Date: 2003/08/29 08:14:59 $
39 *
40 * File version: $Revision: 1.1 $
41 *
42 * Project version: $Name: $
43 *
44 * $Id: ConditionOperator.java,v 1.1 2003/08/29 08:14:59 chous Exp $
45 *
46 */
47 package org.acmsl.queryj;
48
49 /*
50 * Importing some ACM-SL classes.
51 */
52 import org.acmsl.queryj.Condition;
53 import org.acmsl.queryj.Field;
54
55 /***
56 * Represents operators used inside conditions.
57 * @author <a href="mailto:jsanleandro@yahoo.es"
58 >Jose San Leandro</a>
59 * @version $Revision: 1.1 $
60 */
61 public abstract class ConditionOperator
62 {
63 /***
64 * The symbol.
65 */
66 private String m__strSymbol;
67
68 /***
69 * Creates a operator using given information.
70 * @param symbol the operator symbol.
71 */
72 public ConditionOperator(String symbol)
73 {
74 unmodifiableSetSymbol(symbol);
75 }
76
77 /***
78 * Specifies the operator symbol.
79 * @param symbol the symbol.
80 */
81 private void unmodifiableSetSymbol(String symbol)
82 {
83 m__strSymbol = symbol;
84 }
85
86 /***
87 * Specifies the operator symbol.
88 * @param symbol the symbol.
89 */
90 protected void setSymbol(String symbol)
91 {
92 unmodifiableSetSymbol(symbol);
93 }
94
95 /***
96 * Retrieves the operator symbol.
97 * @return such symbol.
98 */
99 public String getSymbol()
100 {
101 return m__strSymbol;
102 }
103
104 /***
105 * Retrieves a text version of the object.
106 * @return such representation.
107 */
108 public String toString()
109 {
110 return getSymbol();
111 }
112
113 /***
114 * Checks if given object is logically equal to this one.
115 * @param candidate the object to check.
116 * @return <code>true</code> if both objects are logically equal.
117 */
118 public boolean equals(Object candidate)
119 {
120 boolean result = (candidate == null);
121
122 if (!result)
123 {
124 result = !(candidate instanceof ConditionOperator);
125 }
126
127 if (!result)
128 {
129 ConditionOperator t_Candidate = (ConditionOperator) candidate;
130
131 result = (t_Candidate.getSymbol() == getSymbol());
132
133 if (!result)
134 {
135 result = (t_Candidate.getSymbol() != null);
136
137 if (result)
138 {
139 result = (t_Candidate.getSymbol().equals(getSymbol()));
140 }
141 else
142 {
143 result = (getSymbol() == null);
144 }
145 }
146 }
147
148 return result;
149 }
150 }
151
This page was automatically generated by Maven