001: /*
002: * ProGuard -- shrinking, optimization, obfuscation, and preverification
003: * of Java bytecode.
004: *
005: * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu)
006: *
007: * This program is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License as published by the Free
009: * Software Foundation; either version 2 of the License, or (at your option)
010: * any later version.
011: *
012: * This program is distributed in the hope that it will be useful, but WITHOUT
013: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
014: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
015: * more details.
016: *
017: * You should have received a copy of the GNU General Public License along
018: * with this program; if not, write to the Free Software Foundation, Inc.,
019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: */
021: package proguard.evaluation.value;
022:
023: import proguard.classfile.ClassConstants;
024:
025: /**
026: * This class represents a partially evaluated long value.
027: *
028: * @author Eric Lafortune
029: */
030: public class LongValue extends Category2Value {
031: /**
032: * Returns the specific long value, if applicable.
033: */
034: public long value() {
035: return 0L;
036: }
037:
038: // Basic binary methods.
039:
040: /**
041: * Returns the generalization of this LongValue and the given other
042: * LongValue.
043: */
044: public LongValue generalize(LongValue other) {
045: return this ;
046: }
047:
048: /**
049: * Returns the sum of this LongValue and the given LongValue.
050: */
051: public LongValue add(LongValue other) {
052: return this ;
053: }
054:
055: /**
056: * Returns the difference of this LongValue and the given LongValue.
057: */
058: public LongValue subtract(LongValue other) {
059: return this ;
060: }
061:
062: /**
063: * Returns the difference of the given LongValue and this LongValue.
064: */
065: public LongValue subtractFrom(LongValue other) {
066: return this ;
067: }
068:
069: /**
070: * Returns the product of this LongValue and the given LongValue.
071: */
072: public LongValue multiply(LongValue other) {
073: return this ;
074: }
075:
076: /**
077: * Returns the quotient of this LongValue and the given LongValue.
078: */
079: public LongValue divide(LongValue other) {
080: return this ;
081: }
082:
083: /**
084: * Returns the quotient of the given LongValue and this LongValue.
085: */
086: public LongValue divideOf(LongValue other) {
087: return this ;
088: }
089:
090: /**
091: * Returns the remainder of this LongValue divided by the given LongValue.
092: */
093: public LongValue remainder(LongValue other) {
094: return this ;
095: }
096:
097: /**
098: * Returns the remainder of the given LongValue divided by this LongValue.
099: */
100: public LongValue remainderOf(LongValue other) {
101: return this ;
102: }
103:
104: /**
105: * Returns this LongValue, shifted left by the given IntegerValue.
106: */
107: public LongValue shiftLeft(IntegerValue other) {
108: return this ;
109: }
110:
111: /**
112: * Returns this LongValue, shifted right by the given IntegerValue.
113: */
114: public LongValue shiftRight(IntegerValue other) {
115: return this ;
116: }
117:
118: /**
119: * Returns this unsigned LongValue, shifted left by the given
120: * IntegerValue.
121: */
122: public LongValue unsignedShiftRight(IntegerValue other) {
123: return this ;
124: }
125:
126: /**
127: * Returns the logical <i>and</i> of this LongValue and the given
128: * LongValue.
129: */
130: public LongValue and(LongValue other) {
131: return this ;
132: }
133:
134: /**
135: * Returns the logical <i>or</i> of this LongValue and the given
136: * LongValue.
137: */
138: public LongValue or(LongValue other) {
139: return this ;
140: }
141:
142: /**
143: * Returns the logical <i>xor</i> of this LongValue and the given
144: * LongValue.
145: */
146: public LongValue xor(LongValue other) {
147: return this ;
148: }
149:
150: /**
151: * Returns an IntegerValue with value -1, 0, or 1, if this LongValue is
152: * less than, equal to, or greater than the given LongValue, respectively.
153: */
154: public IntegerValue compare(LongValue other,
155: ValueFactory valueFactory) {
156: return valueFactory.createIntegerValue();
157: }
158:
159: // Derived binary methods.
160:
161: /**
162: * Returns an IntegerValue with value 1, 0, or -1, if this LongValue is
163: * less than, equal to, or greater than the given LongValue, respectively.
164: */
165: public final IntegerValue compareReverse(LongValue other,
166: ValueFactory valueFactory) {
167: return compare(other, valueFactory).negate();
168: }
169:
170: // Basic unary methods.
171:
172: /**
173: * Returns the negated value of this LongValue.
174: */
175: public LongValue negate() {
176: return this ;
177: }
178:
179: /**
180: * Converts this LongValue to an IntegerValue.
181: */
182: public IntegerValue convertToInteger(ValueFactory valueFactory) {
183: return valueFactory.createIntegerValue();
184: }
185:
186: /**
187: * Converts this LongValue to a FloatValue.
188: */
189: public FloatValue convertToFloat(ValueFactory valueFactory) {
190: return valueFactory.createFloatValue();
191: }
192:
193: /**
194: * Converts this LongValue to a DoubleValue.
195: */
196: public DoubleValue convertToDouble(ValueFactory valueFactory) {
197: return valueFactory.createDoubleValue();
198: }
199:
200: // Similar binary methods, but this time with more specific arguments.
201:
202: /**
203: * Returns the generalization of this LongValue and the given other
204: * SpecificLongValue.
205: */
206: public LongValue generalize(SpecificLongValue other) {
207: return this ;
208: }
209:
210: /**
211: * Returns the sum of this LongValue and the given SpecificLongValue.
212: */
213: public LongValue add(SpecificLongValue other) {
214: return this ;
215: }
216:
217: /**
218: * Returns the difference of this LongValue and the given SpecificLongValue.
219: */
220: public LongValue subtract(SpecificLongValue other) {
221: return this ;
222: }
223:
224: /**
225: * Returns the difference of the given SpecificLongValue and this LongValue.
226: */
227: public LongValue subtractFrom(SpecificLongValue other) {
228: return this ;
229: }
230:
231: /**
232: * Returns the product of this LongValue and the given SpecificLongValue.
233: */
234: public LongValue multiply(SpecificLongValue other) {
235: return this ;
236: }
237:
238: /**
239: * Returns the quotient of this LongValue and the given SpecificLongValue.
240: */
241: public LongValue divide(SpecificLongValue other) {
242: return this ;
243: }
244:
245: /**
246: * Returns the quotient of the given SpecificLongValue and this LongValue.
247: */
248: public LongValue divideOf(SpecificLongValue other) {
249: return this ;
250: }
251:
252: /**
253: * Returns the remainder of this LongValue divided by the given
254: * SpecificLongValue.
255: */
256: public LongValue remainder(SpecificLongValue other) {
257: return this ;
258: }
259:
260: /**
261: * Returns the remainder of the given SpecificLongValue and this
262: * LongValue.
263: */
264: public LongValue remainderOf(SpecificLongValue other) {
265: return this ;
266: }
267:
268: /**
269: * Returns this LongValue, shifted left by the given SpecificIntegerValue.
270: */
271: public LongValue shiftLeft(SpecificIntegerValue other) {
272: return this ;
273: }
274:
275: /**
276: * Returns this LongValue, shifted right by the given SpecificIntegerValue.
277: */
278: public LongValue shiftRight(SpecificIntegerValue other) {
279: return this ;
280: }
281:
282: /**
283: * Returns this unsigned LongValue, shifted left by the given
284: * SpecificIntegerValue.
285: */
286: public LongValue unsignedShiftRight(SpecificIntegerValue other) {
287: return this ;
288: }
289:
290: /**
291: * Returns the logical <i>and</i> of this LongValue and the given
292: * SpecificLongValue.
293: */
294: public LongValue and(SpecificLongValue other) {
295: return this ;
296: }
297:
298: /**
299: * Returns the logical <i>or</i> of this LongValue and the given
300: * SpecificLongValue.
301: */
302: public LongValue or(SpecificLongValue other) {
303: return this ;
304: }
305:
306: /**
307: * Returns the logical <i>xor</i> of this LongValue and the given
308: * SpecificLongValue.
309: */
310: public LongValue xor(SpecificLongValue other) {
311: return this ;
312: }
313:
314: /**
315: * Returns an IntegerValue with value -1, 0, or 1, if this LongValue is
316: * less than, equal to, or greater than the given SpecificLongValue,
317: * respectively.
318: */
319: public IntegerValue compare(SpecificLongValue other,
320: ValueFactory valueFactory) {
321: return valueFactory.createIntegerValue();
322: }
323:
324: // Derived binary methods.
325:
326: /**
327: * Returns an IntegerValue with value 1, 0, or -1, if this LongValue is
328: * less than, equal to, or greater than the given SpecificLongValue,
329: * respectively.
330: */
331: public final IntegerValue compareReverse(SpecificLongValue other,
332: ValueFactory valueFactory) {
333: return compare(other, valueFactory).negate();
334: }
335:
336: // Implementations for Value.
337:
338: public final LongValue longValue() {
339: return this ;
340: }
341:
342: public final Value generalize(Value other) {
343: return this .generalize(other.longValue());
344: }
345:
346: public final int computationalType() {
347: return TYPE_LONG;
348: }
349:
350: public final String internalType() {
351: return String.valueOf(ClassConstants.INTERNAL_TYPE_LONG);
352: }
353:
354: // Implementations for Object.
355:
356: public boolean equals(Object object) {
357: return object != null && this .getClass() == object.getClass();
358: }
359:
360: public int hashCode() {
361: return this .getClass().hashCode();
362: }
363:
364: public String toString() {
365: return "l";
366: }
367: }
|