KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > proguard > evaluation > value > LongValue


1 /*
2  * ProGuard -- shrinking, optimization, obfuscation, and preverification
3  * of Java bytecode.
4  *
5  * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu)
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the Free
9  * Software Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15  * more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */

21 package proguard.evaluation.value;
22
23 import proguard.classfile.ClassConstants;
24
25 /**
26  * This class represents a partially evaluated long value.
27  *
28  * @author Eric Lafortune
29  */

30 public class LongValue extends Category2Value
31 {
32     /**
33      * Returns the specific long value, if applicable.
34      */

35     public long value()
36     {
37         return 0L;
38     }
39
40
41     // Basic binary methods.
42

43     /**
44      * Returns the generalization of this LongValue and the given other
45      * LongValue.
46      */

47     public LongValue generalize(LongValue other)
48     {
49         return this;
50     }
51
52
53     /**
54      * Returns the sum of this LongValue and the given LongValue.
55      */

56     public LongValue add(LongValue other)
57     {
58         return this;
59     }
60
61     /**
62      * Returns the difference of this LongValue and the given LongValue.
63      */

64     public LongValue subtract(LongValue other)
65     {
66         return this;
67     }
68
69     /**
70      * Returns the difference of the given LongValue and this LongValue.
71      */

72     public LongValue subtractFrom(LongValue other)
73     {
74         return this;
75     }
76
77     /**
78      * Returns the product of this LongValue and the given LongValue.
79      */

80     public LongValue multiply(LongValue other)
81     {
82         return this;
83     }
84
85     /**
86      * Returns the quotient of this LongValue and the given LongValue.
87      */

88     public LongValue divide(LongValue other)
89     {
90         return this;
91     }
92
93     /**
94      * Returns the quotient of the given LongValue and this LongValue.
95      */

96     public LongValue divideOf(LongValue other)
97     {
98         return this;
99     }
100
101     /**
102      * Returns the remainder of this LongValue divided by the given LongValue.
103      */

104     public LongValue remainder(LongValue other)
105     {
106         return this;
107     }
108
109     /**
110      * Returns the remainder of the given LongValue divided by this LongValue.
111      */

112     public LongValue remainderOf(LongValue other)
113     {
114         return this;
115     }
116
117     /**
118      * Returns this LongValue, shifted left by the given IntegerValue.
119      */

120     public LongValue shiftLeft(IntegerValue other)
121     {
122         return this;
123     }
124
125     /**
126      * Returns this LongValue, shifted right by the given IntegerValue.
127      */

128     public LongValue shiftRight(IntegerValue other)
129     {
130         return this;
131     }
132
133     /**
134      * Returns this unsigned LongValue, shifted left by the given
135      * IntegerValue.
136      */

137     public LongValue unsignedShiftRight(IntegerValue other)
138     {
139         return this;
140     }
141
142     /**
143      * Returns the logical <i>and</i> of this LongValue and the given
144      * LongValue.
145      */

146     public LongValue and(LongValue other)
147     {
148         return this;
149     }
150
151     /**
152      * Returns the logical <i>or</i> of this LongValue and the given
153      * LongValue.
154      */

155     public LongValue or(LongValue other)
156     {
157         return this;
158     }
159
160     /**
161      * Returns the logical <i>xor</i> of this LongValue and the given
162      * LongValue.
163      */

164     public LongValue xor(LongValue other)
165     {
166         return this;
167     }
168
169     /**
170      * Returns an IntegerValue with value -1, 0, or 1, if this LongValue is
171      * less than, equal to, or greater than the given LongValue, respectively.
172      */

173     public IntegerValue compare(LongValue other, ValueFactory valueFactory)
174     {
175         return valueFactory.createIntegerValue();
176     }
177
178
179     // Derived binary methods.
180

181     /**
182      * Returns an IntegerValue with value 1, 0, or -1, if this LongValue is
183      * less than, equal to, or greater than the given LongValue, respectively.
184      */

185     public final IntegerValue compareReverse(LongValue other, ValueFactory valueFactory)
186     {
187         return compare(other, valueFactory).negate();
188     }
189
190
191     // Basic unary methods.
192

193     /**
194      * Returns the negated value of this LongValue.
195      */

196     public LongValue negate()
197     {
198         return this;
199     }
200
201     /**
202      * Converts this LongValue to an IntegerValue.
203      */

204     public IntegerValue convertToInteger(ValueFactory valueFactory)
205     {
206         return valueFactory.createIntegerValue();
207     }
208
209     /**
210      * Converts this LongValue to a FloatValue.
211      */

212     public FloatValue convertToFloat(ValueFactory valueFactory)
213     {
214         return valueFactory.createFloatValue();
215     }
216
217     /**
218      * Converts this LongValue to a DoubleValue.
219      */

220     public DoubleValue convertToDouble(ValueFactory valueFactory)
221     {
222         return valueFactory.createDoubleValue();
223     }
224
225
226     // Similar binary methods, but this time with more specific arguments.
227

228     /**
229      * Returns the generalization of this LongValue and the given other
230      * SpecificLongValue.
231      */

232     public LongValue generalize(SpecificLongValue other)
233     {
234         return this;
235     }
236
237
238     /**
239      * Returns the sum of this LongValue and the given SpecificLongValue.
240      */

241     public LongValue add(SpecificLongValue other)
242     {
243         return this;
244     }
245
246     /**
247      * Returns the difference of this LongValue and the given SpecificLongValue.
248      */

249     public LongValue subtract(SpecificLongValue other)
250     {
251         return this;
252     }
253
254     /**
255      * Returns the difference of the given SpecificLongValue and this LongValue.
256      */

257     public LongValue subtractFrom(SpecificLongValue other)
258     {
259         return this;
260     }
261
262     /**
263      * Returns the product of this LongValue and the given SpecificLongValue.
264      */

265     public LongValue multiply(SpecificLongValue other)
266     {
267         return this;
268     }
269
270     /**
271      * Returns the quotient of this LongValue and the given SpecificLongValue.
272      */

273     public LongValue divide(SpecificLongValue other)
274     {
275         return this;
276     }
277
278     /**
279      * Returns the quotient of the given SpecificLongValue and this LongValue.
280      */

281     public LongValue divideOf(SpecificLongValue other)
282     {
283         return this;
284     }
285
286     /**
287      * Returns the remainder of this LongValue divided by the given
288      * SpecificLongValue.
289      */

290     public LongValue remainder(SpecificLongValue other)
291     {
292         return this;
293     }
294
295     /**
296      * Returns the remainder of the given SpecificLongValue and this
297      * LongValue.
298      */

299     public LongValue remainderOf(SpecificLongValue other)
300     {
301         return this;
302     }
303
304     /**
305      * Returns this LongValue, shifted left by the given SpecificIntegerValue.
306      */

307     public LongValue shiftLeft(SpecificIntegerValue other)
308     {
309         return this;
310     }
311
312     /**
313      * Returns this LongValue, shifted right by the given SpecificIntegerValue.
314      */

315     public LongValue shiftRight(SpecificIntegerValue other)
316     {
317         return this;
318     }
319
320     /**
321      * Returns this unsigned LongValue, shifted left by the given
322      * SpecificIntegerValue.
323      */

324     public LongValue unsignedShiftRight(SpecificIntegerValue other)
325     {
326         return this;
327     }
328
329     /**
330      * Returns the logical <i>and</i> of this LongValue and the given
331      * SpecificLongValue.
332      */

333     public LongValue and(SpecificLongValue other)
334     {
335         return this;
336     }
337
338     /**
339      * Returns the logical <i>or</i> of this LongValue and the given
340      * SpecificLongValue.
341      */

342     public LongValue or(SpecificLongValue other)
343     {
344         return this;
345     }
346
347     /**
348      * Returns the logical <i>xor</i> of this LongValue and the given
349      * SpecificLongValue.
350      */

351     public LongValue xor(SpecificLongValue other)
352     {
353         return this;
354     }
355
356     /**
357      * Returns an IntegerValue with value -1, 0, or 1, if this LongValue is
358      * less than, equal to, or greater than the given SpecificLongValue,
359      * respectively.
360      */

361     public IntegerValue compare(SpecificLongValue other, ValueFactory valueFactory)
362     {
363         return valueFactory.createIntegerValue();
364     }
365
366
367     // Derived binary methods.
368

369     /**
370      * Returns an IntegerValue with value 1, 0, or -1, if this LongValue is
371      * less than, equal to, or greater than the given SpecificLongValue,
372      * respectively.
373      */

374     public final IntegerValue compareReverse(SpecificLongValue other, ValueFactory valueFactory)
375     {
376         return compare(other, valueFactory).negate();
377     }
378
379
380     // Implementations for Value.
381

382     public final LongValue longValue()
383     {
384         return this;
385     }
386
387     public final Value generalize(Value other)
388     {
389         return this.generalize(other.longValue());
390     }
391
392     public final int computationalType()
393     {
394         return TYPE_LONG;
395     }
396
397     public final String JavaDoc internalType()
398     {
399         return "" + ClassConstants.INTERNAL_TYPE_LONG;
400     }
401
402
403     // Implementations for Object.
404

405     public boolean equals(Object JavaDoc object)
406     {
407         return object != null &&
408                this.getClass() == object.getClass();
409     }
410
411
412     public int hashCode()
413     {
414         return this.getClass().hashCode();
415     }
416
417
418     public String JavaDoc toString()
419     {
420         return "l";
421     }
422 }
423
Popular Tags