Source Code Cross Referenced for CpoolEntry.java in  » Scripting » Kawa » gnu » bytecode » 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 » Kawa » gnu.bytecode 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        // Copyright (c) 1997  Per M.A. Bothner.
02:        // This is free software;  for terms and warranty disclaimer see ./COPYING.
03:
04:        package gnu.bytecode;
05:
06:        import java.io.*;
07:
08:        /**
09:         * An entry in the constant pool for a ClassType.
10:         * Each entry belong to the constant pool table of the "owning"
11:         * ClassType.  Hashing is used to make each entry unique (with a ClassType).
12:         * By convention, each sub-class has a static get_const method which is
13:         * used when a contant pool entry is need:  The get_const method will
14:         * return an existing matching entry if possible, or allocate a new
15:         * one if needed.
16:         * @author	Per Bothner
17:         */
18:
19:        abstract public class CpoolEntry {
20:            /** A hashvalue so we do not get duplicate constant pool entries. */
21:            int hash;
22:
23:            /** This entry's index in the constant pool. */
24:            public int index;
25:
26:            public int getIndex() {
27:                return index;
28:            }
29:
30:            /** The next entry in the same hash bucket
31:             * (of the owning ConstantPool's hashTab). */
32:            CpoolEntry next;
33:
34:            public abstract int getTag();
35:
36:            public int hashCode() {
37:                return hash;
38:            }
39:
40:            abstract void write(DataOutputStream str)
41:                    throws java.io.IOException;
42:
43:            /**
44:             * Enter current element into cpool.hashTab.
45:             */
46:            void add_hashed(ConstantPool cpool) {
47:                CpoolEntry[] hashTab = cpool.hashTab;
48:                int index = (hash & 0x7FFFFFFF) % hashTab.length;
49:                next = hashTab[index];
50:                hashTab[index] = this ;
51:            }
52:
53:            protected CpoolEntry() {
54:            }
55:
56:            public CpoolEntry(ConstantPool cpool, int h) {
57:                hash = h;
58:                if (cpool.locked)
59:                    throw new Error("adding new entry to locked contant pool");
60:                index = ++cpool.count;
61:
62:                // (Re-)allocate the cpool.pool array if need be.
63:                if (cpool.pool == null)
64:                    cpool.pool = new CpoolEntry[60];
65:                else if (index >= cpool.pool.length) {
66:                    int old_size = cpool.pool.length;
67:                    int new_size = 2 * cpool.pool.length;
68:                    CpoolEntry[] new_pool = new CpoolEntry[new_size];
69:                    for (int i = 0; i < old_size; i++)
70:                        new_pool[i] = cpool.pool[i];
71:                    cpool.pool = new_pool;
72:                }
73:
74:                // Re-hash cpool.hashTab hash_table if needed.
75:                if (cpool.hashTab == null
76:                        || index >= 0.60 * cpool.hashTab.length)
77:                    cpool.rehash();
78:
79:                // Enter into cpool.constant_pool array.
80:                cpool.pool[index] = this ;
81:                // Enter into cpool.hashTab hash table.
82:                add_hashed(cpool);
83:            }
84:
85:            /** Print this constant pool entry.
86:             * If verbosity==0, print very tersely (no extraneous text).
87:             * If verbosity==1, prefix the type of the constant.
88:             * If verbosity==2, add more descriptive text. */
89:
90:            public abstract void print(ClassTypeWriter dst, int verbosity);
91:        };
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.