Source Code Cross Referenced for SpecificIntegerValue.java in  » Development » proguard » proguard » evaluation » value » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Development » proguard » proguard.evaluation.value 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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:        /**
024:         * This IntegerValue represents a specific integer value.
025:         *
026:         * @author Eric Lafortune
027:         */
028:        final class SpecificIntegerValue extends IntegerValue {
029:            private final int value;
030:
031:            public SpecificIntegerValue(int value) {
032:                this .value = value;
033:            }
034:
035:            // Implementations for IntegerValue.
036:
037:            public int value() {
038:                return value;
039:            }
040:
041:            // Implementations of binary methods of IntegerValue.
042:
043:            // Perhaps the other value arguments are more specific than apparent
044:            // in these methods, so delegate to them.
045:
046:            public IntegerValue generalize(IntegerValue other) {
047:                return other.generalize(this );
048:            }
049:
050:            public IntegerValue add(IntegerValue other) {
051:                return other.add(this );
052:            }
053:
054:            public IntegerValue subtract(IntegerValue other) {
055:                return other.subtractFrom(this );
056:            }
057:
058:            public IntegerValue subtractFrom(IntegerValue other) {
059:                return other.subtract(this );
060:            }
061:
062:            public IntegerValue multiply(IntegerValue other) {
063:                return other.multiply(this );
064:            }
065:
066:            public IntegerValue divide(IntegerValue other)
067:                    throws ArithmeticException {
068:                return other.divideOf(this );
069:            }
070:
071:            public IntegerValue divideOf(IntegerValue other)
072:                    throws ArithmeticException {
073:                return other.divide(this );
074:            }
075:
076:            public IntegerValue remainder(IntegerValue other)
077:                    throws ArithmeticException {
078:                return other.remainderOf(this );
079:            }
080:
081:            public IntegerValue remainderOf(IntegerValue other)
082:                    throws ArithmeticException {
083:                return other.remainder(this );
084:            }
085:
086:            public IntegerValue shiftLeft(IntegerValue other) {
087:                return other.shiftLeftOf(this );
088:            }
089:
090:            public IntegerValue shiftLeftOf(IntegerValue other) {
091:                return other.shiftLeft(this );
092:            }
093:
094:            public IntegerValue shiftRight(IntegerValue other) {
095:                return other.shiftRightOf(this );
096:            }
097:
098:            public IntegerValue shiftRightOf(IntegerValue other) {
099:                return other.shiftRight(this );
100:            }
101:
102:            public IntegerValue unsignedShiftRight(IntegerValue other) {
103:                return other.unsignedShiftRightOf(this );
104:            }
105:
106:            public IntegerValue unsignedShiftRightOf(IntegerValue other) {
107:                return other.unsignedShiftRight(this );
108:            }
109:
110:            public LongValue shiftLeftOf(LongValue other) {
111:                return other.shiftLeft(this );
112:            }
113:
114:            public LongValue shiftRightOf(LongValue other) {
115:                return other.shiftRight(this );
116:            }
117:
118:            public LongValue unsignedShiftRightOf(LongValue other) {
119:                return other.unsignedShiftRight(this );
120:            }
121:
122:            public IntegerValue and(IntegerValue other) {
123:                return other.and(this );
124:            }
125:
126:            public IntegerValue or(IntegerValue other) {
127:                return other.or(this );
128:            }
129:
130:            public IntegerValue xor(IntegerValue other) {
131:                return other.xor(this );
132:            }
133:
134:            public int equal(IntegerValue other) {
135:                return other.equal(this );
136:            }
137:
138:            public int lessThan(IntegerValue other) {
139:                return other.greaterThan(this );
140:            }
141:
142:            public int lessThanOrEqual(IntegerValue other) {
143:                return other.greaterThanOrEqual(this );
144:            }
145:
146:            // Implementations of unary methods of IntegerValue.
147:
148:            public IntegerValue negate() {
149:                return new SpecificIntegerValue(-value);
150:            }
151:
152:            public IntegerValue convertToByte(ValueFactory valueFactory) {
153:                int byteValue = (byte) value;
154:
155:                return byteValue == value ? this  : new SpecificIntegerValue(
156:                        byteValue);
157:            }
158:
159:            public IntegerValue convertToCharacter(ValueFactory valueFactory) {
160:                int charValue = (char) value;
161:
162:                return charValue == value ? this  : new SpecificIntegerValue(
163:                        charValue);
164:            }
165:
166:            public IntegerValue convertToShort(ValueFactory valueFactory) {
167:                int shortValue = (short) value;
168:
169:                return shortValue == value ? this  : new SpecificIntegerValue(
170:                        shortValue);
171:            }
172:
173:            public IntegerValue convertToInteger(ValueFactory valueFactory) {
174:                return this ;
175:            }
176:
177:            public LongValue convertToLong(ValueFactory valueFactory) {
178:                return valueFactory.createLongValue((long) value);
179:            }
180:
181:            public FloatValue convertToFloat(ValueFactory valueFactory) {
182:                return valueFactory.createFloatValue((float) value);
183:            }
184:
185:            public DoubleValue convertToDouble(ValueFactory valueFactory) {
186:                return valueFactory.createDoubleValue((double) value);
187:            }
188:
189:            // Implementations of binary IntegerValue methods with SpecificIntegerValue
190:            // arguments.
191:
192:            public IntegerValue generalize(SpecificIntegerValue other) {
193:                return this .value == other.value ? this 
194:                        : ValueFactory.INTEGER_VALUE;
195:            }
196:
197:            public IntegerValue add(SpecificIntegerValue other) {
198:                return new SpecificIntegerValue(this .value + other.value);
199:            }
200:
201:            public IntegerValue subtract(SpecificIntegerValue other) {
202:                return new SpecificIntegerValue(this .value - other.value);
203:            }
204:
205:            public IntegerValue subtractFrom(SpecificIntegerValue other) {
206:                return new SpecificIntegerValue(other.value - this .value);
207:            }
208:
209:            public IntegerValue multiply(SpecificIntegerValue other) {
210:                return new SpecificIntegerValue(this .value * other.value);
211:            }
212:
213:            public IntegerValue divide(SpecificIntegerValue other)
214:                    throws ArithmeticException {
215:                return new SpecificIntegerValue(this .value / other.value);
216:            }
217:
218:            public IntegerValue divideOf(SpecificIntegerValue other)
219:                    throws ArithmeticException {
220:                return new SpecificIntegerValue(other.value / this .value);
221:            }
222:
223:            public IntegerValue remainder(SpecificIntegerValue other)
224:                    throws ArithmeticException {
225:                return new SpecificIntegerValue(this .value % other.value);
226:            }
227:
228:            public IntegerValue remainderOf(SpecificIntegerValue other)
229:                    throws ArithmeticException {
230:                return new SpecificIntegerValue(other.value % this .value);
231:            }
232:
233:            public IntegerValue shiftLeft(SpecificIntegerValue other) {
234:                return new SpecificIntegerValue(this .value << other.value);
235:            }
236:
237:            public IntegerValue shiftLeftOf(SpecificIntegerValue other) {
238:                return new SpecificIntegerValue(other.value << this .value);
239:            }
240:
241:            public IntegerValue shiftRight(SpecificIntegerValue other) {
242:                return new SpecificIntegerValue(this .value >> other.value);
243:            }
244:
245:            public IntegerValue shiftRightOf(SpecificIntegerValue other) {
246:                return new SpecificIntegerValue(other.value >> this .value);
247:            }
248:
249:            public IntegerValue unsignedShiftRight(SpecificIntegerValue other) {
250:                return new SpecificIntegerValue(this .value >>> other.value);
251:            }
252:
253:            public IntegerValue unsignedShiftRightOf(SpecificIntegerValue other) {
254:                return new SpecificIntegerValue(other.value >>> this .value);
255:            }
256:
257:            public LongValue shiftLeftOf(SpecificLongValue other,
258:                    ValueFactory valueFactory) {
259:                return valueFactory
260:                        .createLongValue(other.value() << this .value);
261:            }
262:
263:            public LongValue shiftRightOf(SpecificLongValue other,
264:                    ValueFactory valueFactory) {
265:                return valueFactory
266:                        .createLongValue(other.value() >> this .value);
267:            }
268:
269:            public LongValue unsignedShiftRightOf(SpecificLongValue other,
270:                    ValueFactory valueFactory) {
271:                return valueFactory
272:                        .createLongValue(other.value() >>> this .value);
273:            }
274:
275:            public IntegerValue and(SpecificIntegerValue other) {
276:                return new SpecificIntegerValue(this .value & other.value);
277:            }
278:
279:            public IntegerValue or(SpecificIntegerValue other) {
280:                return new SpecificIntegerValue(this .value | other.value);
281:            }
282:
283:            public IntegerValue xor(SpecificIntegerValue other) {
284:                return new SpecificIntegerValue(this .value ^ other.value);
285:            }
286:
287:            public int equal(SpecificIntegerValue other) {
288:                return this .value == other.value ? ALWAYS : NEVER;
289:            }
290:
291:            public int lessThan(SpecificIntegerValue other) {
292:                return this .value < other.value ? ALWAYS : NEVER;
293:            }
294:
295:            public int lessThanOrEqual(SpecificIntegerValue other) {
296:                return this .value <= other.value ? ALWAYS : NEVER;
297:            }
298:
299:            // Implementations for Value.
300:
301:            public boolean isSpecific() {
302:                return true;
303:            }
304:
305:            // Implementations for Object.
306:
307:            public boolean equals(Object object) {
308:                return object != null && this .getClass() == object.getClass()
309:                        && this .value == ((SpecificIntegerValue) object).value;
310:            }
311:
312:            public int hashCode() {
313:                return this .getClass().hashCode() ^ value;
314:            }
315:
316:            public String toString() {
317:                return "i:" + value;
318:            }
319:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.