Source Code Cross Referenced for TypesLengths.java in  » Apache-Harmony-Java-SE » org-package » org » apache » harmony » jpda » tests » framework » jdwp » 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 » Apache Harmony Java SE » org package » org.apache.harmony.jpda.tests.framework.jdwp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *
015:         *  See the License for the specific language governing permissions and
016:         *  limitations under the License.
017:         */
018:
019:        /**
020:         * @author Aleksey V. Yantsen
021:         * @version $Revision: 1.6 $
022:         */
023:
024:        /**
025:         * Created on 12.23.2004
026:         */package org.apache.harmony.jpda.tests.framework.jdwp;
027:
028:        import org.apache.harmony.jpda.tests.framework.TestErrorException;
029:
030:        /**
031:         * This class provides types length for VM-independent and VM-dependent types.
032:         */
033:        public class TypesLengths {
034:
035:            // Type IDs
036:            public static final byte BYTE_ID = 1;
037:
038:            public static final byte BOOLEAN_ID = 2;
039:
040:            public static final byte INT_ID = 3;
041:
042:            public static final byte LONG_ID = 4;
043:
044:            public static final byte SHORT_ID = 5;
045:
046:            public static final byte FLOAT_ID = 6;
047:
048:            public static final byte DOUBLE_ID = 7;
049:
050:            public static final byte VOID_ID = 8;
051:
052:            public static final byte OBJECT_ID = 9;
053:
054:            public static final byte ARRAY_ID = 10;
055:
056:            public static final byte STRING_ID = 11;
057:
058:            public static final byte THREAD_ID = 12;
059:
060:            public static final byte THREADGROUP_ID = 13;
061:
062:            public static final byte METHOD_ID = 14;
063:
064:            public static final byte FIELD_ID = 15;
065:
066:            public static final byte FRAME_ID = 16;
067:
068:            public static final byte LOCATION_ID = 17;
069:
070:            public static final byte REFERENCE_TYPE_ID = 18;
071:
072:            public static final byte CLASS_ID = 19;
073:
074:            public static final byte CLASSLOADER_ID = 20;
075:
076:            public static final byte CLASSOBJECT_ID = 21;
077:
078:            public static final byte CHAR_ID = 22;
079:
080:            // Type lengths in bytes (VM-independent)
081:
082:            private static int byteLength = 1;
083:
084:            private static int booleanLength = 1;
085:
086:            private static int intLength = 4;
087:
088:            private static int longLength = 8;
089:
090:            private static int shortLength = 2;
091:
092:            private static int floatLength = 4;
093:
094:            private static int doubleLength = 8;
095:
096:            private static int voidLength = 0;
097:
098:            private static int charLength = 2;
099:
100:            // Type lengths in bytes (VM-dependent)
101:
102:            private static int objectLength;
103:
104:            private static int arrayLength;
105:
106:            private static int stringLength;
107:
108:            private static int threadLength;
109:
110:            private static int threadGroupLength;
111:
112:            private static int methodLength;
113:
114:            private static int fieldLength;
115:
116:            private static int frameLength;
117:
118:            private static int locationLength;
119:
120:            private static int referenceLength;
121:
122:            private static int classLength;
123:
124:            private static int classLoaderLength;
125:
126:            private static int classObjectLength;
127:
128:            /**
129:             * Gets types length for type ID.
130:             * 
131:             * @param typeID
132:             *            Type ID
133:             * @return type length
134:             */
135:            public static int getTypeLength(byte typeID)
136:                    throws TestErrorException {
137:                switch (typeID) {
138:                case BYTE_ID: {
139:                    return byteLength;
140:                }
141:                case BOOLEAN_ID: {
142:                    return booleanLength;
143:                }
144:                case INT_ID: {
145:                    return intLength;
146:                }
147:                case LONG_ID: {
148:                    return longLength;
149:                }
150:                case SHORT_ID: {
151:                    return shortLength;
152:                }
153:                case FLOAT_ID: {
154:                    return floatLength;
155:                }
156:                case DOUBLE_ID: {
157:                    return doubleLength;
158:                }
159:                case VOID_ID: {
160:                    return voidLength;
161:                }
162:                case OBJECT_ID: {
163:                    return objectLength;
164:                }
165:                case ARRAY_ID: {
166:                    return arrayLength;
167:                }
168:                case STRING_ID: {
169:                    return stringLength;
170:                }
171:                case THREAD_ID: {
172:                    return threadLength;
173:                }
174:                case THREADGROUP_ID: {
175:                    return threadGroupLength;
176:                }
177:                case METHOD_ID: {
178:                    return methodLength;
179:                }
180:                case FIELD_ID: {
181:                    return fieldLength;
182:                }
183:                case FRAME_ID: {
184:                    return frameLength;
185:                }
186:                case LOCATION_ID: {
187:                    return locationLength;
188:                }
189:                case REFERENCE_TYPE_ID: {
190:                    return referenceLength;
191:                }
192:                case CLASS_ID: {
193:                    return classLength;
194:                }
195:                case CLASSLOADER_ID: {
196:                    return classLoaderLength;
197:                }
198:                case CLASSOBJECT_ID: {
199:                    return classObjectLength;
200:                }
201:                case CHAR_ID: {
202:                    return charLength;
203:                }
204:                default:
205:                    throw new TestErrorException("Unexpected type ID: "
206:                            + typeID);
207:                }
208:            }
209:
210:            /**
211:             * Sets types length for type ID
212:             * 
213:             * @param typeID Type ID
214:             * @param typeLength type length
215:             */
216:            public static void setTypeLength(byte typeID, int typeLength)
217:                    throws TestErrorException {
218:                switch (typeID) {
219:                case BYTE_ID: {
220:                    byteLength = typeLength;
221:                    return;
222:                }
223:                case BOOLEAN_ID: {
224:                    booleanLength = typeLength;
225:                    return;
226:                }
227:                case INT_ID: {
228:                    intLength = typeLength;
229:                    return;
230:                }
231:                case LONG_ID: {
232:                    longLength = typeLength;
233:                    return;
234:                }
235:                case SHORT_ID: {
236:                    shortLength = typeLength;
237:                    return;
238:                }
239:                case FLOAT_ID: {
240:                    floatLength = typeLength;
241:                    return;
242:                }
243:                case DOUBLE_ID: {
244:                    doubleLength = typeLength;
245:                    return;
246:                }
247:                case VOID_ID: {
248:                    voidLength = typeLength;
249:                    return;
250:                }
251:                case OBJECT_ID: {
252:                    objectLength = typeLength;
253:                    return;
254:                }
255:                case ARRAY_ID: {
256:                    arrayLength = typeLength;
257:                    return;
258:                }
259:                case STRING_ID: {
260:                    stringLength = typeLength;
261:                    return;
262:                }
263:                case THREAD_ID: {
264:                    threadLength = typeLength;
265:                    return;
266:                }
267:                case THREADGROUP_ID: {
268:                    threadGroupLength = typeLength;
269:                    return;
270:                }
271:                case METHOD_ID: {
272:                    methodLength = typeLength;
273:                    return;
274:                }
275:                case FIELD_ID: {
276:                    fieldLength = typeLength;
277:                    return;
278:                }
279:                case FRAME_ID: {
280:                    frameLength = typeLength;
281:                    return;
282:                }
283:                case LOCATION_ID: {
284:                    locationLength = typeLength;
285:                    return;
286:                }
287:                case REFERENCE_TYPE_ID: {
288:                    referenceLength = typeLength;
289:                    return;
290:                }
291:                case CLASS_ID: {
292:                    classLength = typeLength;
293:                    return;
294:                }
295:                case CLASSLOADER_ID: {
296:                    classLoaderLength = typeLength;
297:                    return;
298:                }
299:                case CLASSOBJECT_ID: {
300:                    classObjectLength = typeLength;
301:                    return;
302:                }
303:                case CHAR_ID: {
304:                    classObjectLength = charLength;
305:                    return;
306:                }
307:                default:
308:                    throw new TestErrorException("Unexpected type ID: "
309:                            + typeID);
310:                }
311:            }
312:        }
w_w__w.__j___a_v___a___2_s._c__om__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.