Source Code Cross Referenced for Item.java in  » Scripting » beanshell » bsh » org » objectweb » asm » 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 » Scripting » beanshell » bsh.org.objectweb.asm 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /***
002:         * ASM: a very small and fast Java bytecode manipulation framework
003:         * Copyright (C) 2000 INRIA, France Telecom
004:         * Copyright (C) 2002 France Telecom
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2 of the License, or (at your option) any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
019:         *
020:         * Contact: Eric.Bruneton@rd.francetelecom.com
021:         *
022:         * Author: Eric Bruneton
023:         */package bsh.org.objectweb.asm;
024:
025:        /**
026:         * A constant pool item. Constant pool items can be created with the 'newXXX'
027:         * methods in the {@link ClassWriter} class.
028:         */
029:
030:        final class Item {
031:
032:            /**
033:             * Index of this item in the constant pool.
034:             */
035:
036:            short index;
037:
038:            /**
039:             * Type of this constant pool item. A single class is used to represent all
040:             * constant pool item types, in order to minimize the bytecode size of this
041:             * package. The value of this field is one of the constants defined in the
042:             * {@link ClassWriter ClassWriter} class.
043:             */
044:
045:            int type;
046:
047:            /**
048:             * Value of this item, for a {@link ClassWriter#INT INT} item.
049:             */
050:
051:            int intVal;
052:
053:            /**
054:             * Value of this item, for a {@link ClassWriter#LONG LONG} item.
055:             */
056:
057:            long longVal;
058:
059:            /**
060:             * Value of this item, for a {@link ClassWriter#FLOAT FLOAT} item.
061:             */
062:
063:            float floatVal;
064:
065:            /**
066:             * Value of this item, for a {@link ClassWriter#DOUBLE DOUBLE} item.
067:             */
068:
069:            double doubleVal;
070:
071:            /**
072:             * First part of the value of this item, for items that do not hold a
073:             * primitive value.
074:             */
075:
076:            String strVal1;
077:
078:            /**
079:             * Second part of the value of this item, for items that do not hold a
080:             * primitive value.
081:             */
082:
083:            String strVal2;
084:
085:            /**
086:             * Third part of the value of this item, for items that do not hold a
087:             * primitive value.
088:             */
089:
090:            String strVal3;
091:
092:            /**
093:             * The hash code value of this constant pool item.
094:             */
095:
096:            int hashCode;
097:
098:            /**
099:             * Link to another constant pool item, used for collision lists in the
100:             * constant pool's hash table.
101:             */
102:
103:            Item next;
104:
105:            /**
106:             * Constructs an uninitialized {@link Item Item} object.
107:             */
108:
109:            Item() {
110:            }
111:
112:            /**
113:             * Constructs a copy of the given item.
114:             *
115:             * @param index index of the item to be constructed.
116:             * @param i the item that must be copied into the item to be constructed.
117:             */
118:
119:            Item(final short index, final Item i) {
120:                this .index = index;
121:                type = i.type;
122:                intVal = i.intVal;
123:                longVal = i.longVal;
124:                floatVal = i.floatVal;
125:                doubleVal = i.doubleVal;
126:                strVal1 = i.strVal1;
127:                strVal2 = i.strVal2;
128:                strVal3 = i.strVal3;
129:                hashCode = i.hashCode;
130:            }
131:
132:            /**
133:             * Sets this item to an {@link ClassWriter#INT INT} item.
134:             *
135:             * @param intVal the value of this item.
136:             */
137:
138:            void set(final int intVal) {
139:                this .type = ClassWriter.INT;
140:                this .intVal = intVal;
141:                this .hashCode = type + intVal;
142:            }
143:
144:            /**
145:             * Sets this item to a {@link ClassWriter#LONG LONG} item.
146:             *
147:             * @param longVal the value of this item.
148:             */
149:
150:            void set(final long longVal) {
151:                this .type = ClassWriter.LONG;
152:                this .longVal = longVal;
153:                this .hashCode = type + (int) longVal;
154:            }
155:
156:            /**
157:             * Sets this item to a {@link ClassWriter#FLOAT FLOAT} item.
158:             *
159:             * @param floatVal the value of this item.
160:             */
161:
162:            void set(final float floatVal) {
163:                this .type = ClassWriter.FLOAT;
164:                this .floatVal = floatVal;
165:                this .hashCode = type + (int) floatVal;
166:            }
167:
168:            /**
169:             * Sets this item to a {@link ClassWriter#DOUBLE DOUBLE} item.
170:             *
171:             * @param doubleVal the value of this item.
172:             */
173:
174:            void set(final double doubleVal) {
175:                this .type = ClassWriter.DOUBLE;
176:                this .doubleVal = doubleVal;
177:                this .hashCode = type + (int) doubleVal;
178:            }
179:
180:            /**
181:             * Sets this item to an item that do not hold a primitive value.
182:             *
183:             * @param type the type of this item.
184:             * @param strVal1 first part of the value of this item.
185:             * @param strVal2 second part of the value of this item.
186:             * @param strVal3 third part of the value of this item.
187:             */
188:
189:            void set(final int type, final String strVal1,
190:                    final String strVal2, final String strVal3) {
191:                this .type = type;
192:                this .strVal1 = strVal1;
193:                this .strVal2 = strVal2;
194:                this .strVal3 = strVal3;
195:                switch (type) {
196:                case ClassWriter.UTF8:
197:                case ClassWriter.STR:
198:                case ClassWriter.CLASS:
199:                    hashCode = type + strVal1.hashCode();
200:                    return;
201:                case ClassWriter.NAME_TYPE:
202:                    hashCode = type + strVal1.hashCode() * strVal2.hashCode();
203:                    return;
204:                    //case ClassWriter.FIELD:
205:                    //case ClassWriter.METH:
206:                    //case ClassWriter.IMETH:
207:                default:
208:                    hashCode = type + strVal1.hashCode() * strVal2.hashCode()
209:                            * strVal3.hashCode();
210:                    return;
211:                }
212:            }
213:
214:            /**
215:             * Indicates if the given item is equal to this one.
216:             *
217:             * @param i the item to be compared to this one.
218:             * @return <tt>true</tt> if the given item if equal to this one,
219:             *      <tt>false</tt> otherwise.
220:             */
221:
222:            boolean isEqualTo(final Item i) {
223:                if (i.type == type) {
224:                    switch (type) {
225:                    case ClassWriter.INT:
226:                        return i.intVal == intVal;
227:                    case ClassWriter.LONG:
228:                        return i.longVal == longVal;
229:                    case ClassWriter.FLOAT:
230:                        return i.floatVal == floatVal;
231:                    case ClassWriter.DOUBLE:
232:                        return i.doubleVal == doubleVal;
233:                    case ClassWriter.UTF8:
234:                    case ClassWriter.STR:
235:                    case ClassWriter.CLASS:
236:                        return i.strVal1.equals(strVal1);
237:                    case ClassWriter.NAME_TYPE:
238:                        return i.strVal1.equals(strVal1)
239:                                && i.strVal2.equals(strVal2);
240:                        //case ClassWriter.FIELD:
241:                        //case ClassWriter.METH:
242:                        //case ClassWriter.IMETH:
243:                    default:
244:                        return i.strVal1.equals(strVal1)
245:                                && i.strVal2.equals(strVal2)
246:                                && i.strVal3.equals(strVal3);
247:                    }
248:                }
249:                return false;
250:            }
251:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.