Source Code Cross Referenced for InternalTables1.java in  » Testing » Marathon » org » python » core » 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 » Testing » Marathon » org.python.core 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // Copyright 2000 Samuele Pedroni
002:
003:        package org.python.core;
004:
005:        import java.util.*;
006:
007:        /**
008:         * 
009:         * @deprecated Java1 no longer supported.
010:         *
011:         */
012:        public class InternalTables1 extends InternalTables {
013:
014:            protected static interface Table {
015:                public Object put(Object key, Object obj);
016:
017:                public Object get(Object key);
018:
019:                public Object remove(Object key);
020:
021:                public void clear();
022:            }
023:
024:            private static class TableProvid1 extends Hashtable implements 
025:                    Table {
026:            }
027:
028:            final protected static short JCLASS = 0;
029:
030:            final protected static short LAZY_JCLASS = 1;
031:
032:            final protected static short ADAPTER_CLASS = 2;
033:
034:            final protected static short ADAPTER = 3;
035:
036:            protected Table classes;
037:
038:            protected Table temp;
039:
040:            protected Table counters;
041:
042:            protected Table lazyClasses;
043:
044:            protected Table adapterClasses;
045:
046:            protected final short GSTABLE = 1;
047:
048:            protected final short JCSTABLE = 2;
049:
050:            protected short keepstable;
051:
052:            protected void beginStable(short lvl) {
053:                this .keepstable = lvl;
054:            }
055:
056:            protected void classesPut(Class c, Object jc) {
057:                if (this .keepstable == this .JCSTABLE) {
058:                    this .temp.put(c, jc);
059:                    // System.err.println("temp-defer-canonical: "+c.getName());
060:                } else {
061:                    this .classes.put(c, jc);
062:                }
063:                String name = c.getName();
064:                Integer cnt = (Integer) this .counters.get(name);
065:                if (cnt == null) {
066:                    this .counters.put(name, new Integer(1));
067:                    this .lazyClasses.remove(name);
068:                } else {
069:                    this .counters.put(name, new Integer(cnt.intValue() + 1));
070:                }
071:            }
072:
073:            protected Object classesGet(Class c) {
074:                Object o = this .classes.get(c);
075:                if (o != null || this .keepstable != this .JCSTABLE)
076:                    return o;
077:                return this .temp.get(c);
078:            }
079:
080:            protected void endStable() {
081:                if (this .keepstable == this .JCSTABLE)
082:                    commitTemp();
083:                this .keepstable = 0;
084:            }
085:
086:            protected void classesDec(String name) {
087:                int c = ((Integer) this .counters.get(name)).intValue();
088:                if (c == 1)
089:                    this .counters.remove(name);
090:                else
091:                    this .counters.put(name, new Integer(c - 1));
092:            }
093:
094:            protected void commitTemp() {
095:                for (Enumeration e = ((Hashtable) this .temp).keys(); e
096:                        .hasMoreElements();) {
097:                    Object c = e.nextElement();
098:                    this .classes.put(c, this .temp.get(c));
099:                }
100:                this .temp.clear();
101:            }
102:
103:            protected boolean queryCanonical(String name) {
104:                return this .counters.get(name) != null
105:                        || this .lazyClasses.get(name) != null;
106:            }
107:
108:            protected PyJavaClass getCanonical(Class c) {
109:                return (PyJavaClass) classesGet(c);
110:            }
111:
112:            protected PyJavaClass getLazyCanonical(String name) {
113:                return (PyJavaClass) this .lazyClasses.get(name);
114:            }
115:
116:            protected void putCanonical(Class c, PyJavaClass canonical) {
117:                classesPut(c, canonical);
118:            }
119:
120:            protected void putLazyCanonical(String name, PyJavaClass canonical) {
121:                this .lazyClasses.put(name, canonical);
122:            }
123:
124:            protected Class getAdapterClass(Class c) {
125:                return (Class) this .adapterClasses.get(c);
126:            }
127:
128:            protected void putAdapterClass(Class c, Class ac) {
129:                this .adapterClasses.put(c, ac);
130:            }
131:
132:            private Hashtable adapters;
133:
134:            protected Object getAdapter(Object o, String evc) {
135:                return this .adapters
136:                        .get(evc + '$' + System.identityHashCode(o));
137:            }
138:
139:            protected void putAdapter(Object o, String evc, Object ad) {
140:                this .adapters.put(evc + '$' + System.identityHashCode(o), ad);
141:            }
142:
143:            protected short iterType;
144:
145:            protected Object cur;
146:
147:            private Enumeration enumm;
148:
149:            private Hashtable enumTable;
150:
151:            public void _beginCanonical() {
152:                beginStable(this .JCSTABLE);
153:                this .enumm = ((TableProvid1) this .classes).keys();
154:                this .enumTable = (TableProvid1) this .classes;
155:                this .iterType = JCLASS;
156:            }
157:
158:            public void _beginLazyCanonical() {
159:                this .enumm = ((TableProvid1) this .lazyClasses).keys();
160:                this .enumTable = (TableProvid1) this .lazyClasses;
161:                this .iterType = LAZY_JCLASS;
162:            }
163:
164:            public void _beginOverAdapterClasses() {
165:                this .enumm = ((TableProvid1) this .adapterClasses).keys();
166:                this .enumTable = (TableProvid1) this .adapterClasses;
167:                this .iterType = ADAPTER_CLASS;
168:
169:            }
170:
171:            public void _beginOverAdapters() {
172:                this .enumm = this .adapters.keys();
173:                this .enumTable = this .adapters;
174:                this .iterType = ADAPTER;
175:            }
176:
177:            public Object _next() {
178:                if (this .enumm.hasMoreElements()) {
179:                    this .cur = this .enumm.nextElement();
180:                    switch (this .iterType) {
181:                    case JCLASS:
182:                        return (PyJavaClass) this .classes.get(this .cur);
183:                    case LAZY_JCLASS:
184:                        PyJavaClass lazy = (PyJavaClass) this .lazyClasses
185:                                .get(this .cur);
186:                        return new _LazyRep(lazy.__name__, lazy.__mgr__);
187:                    case ADAPTER_CLASS:
188:                        return this .cur;
189:                    case ADAPTER:
190:                        return this .adapters.get(this .cur).getClass()
191:                                .getInterfaces()[0];
192:                    }
193:                }
194:                this .cur = null;
195:                this .enumm = null;
196:                endStable();
197:                return null;
198:            }
199:
200:            public void _flushCurrent() {
201:                this .enumTable.remove(this .cur);
202:                if (this .iterType == JCLASS)
203:                    classesDec(((Class) this .cur).getName());
204:            }
205:
206:            public void _flush(PyJavaClass jc) {
207:                Class c = jc.proxyClass;
208:                if (c == null) {
209:                    this .lazyClasses.remove(jc.__name__);
210:                } else {
211:                    this .classes.remove(c);
212:                    classesDec(jc.__name__);
213:                }
214:            }
215:
216:            protected InternalTables1(boolean fake) {
217:            }
218:
219:            public InternalTables1() {
220:                this .classes = new TableProvid1();
221:                this .temp = new TableProvid1();
222:                this .counters = new TableProvid1();
223:                this .lazyClasses = new TableProvid1();
224:
225:                this .adapterClasses = new TableProvid1();
226:
227:                this .adapters = new Hashtable();
228:            }
229:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.