Source Code Cross Referenced for FieldInfo.java in  » Code-Analyzer » javapathfinder » gov » nasa » jpf » jvm » 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 » Code Analyzer » javapathfinder » gov.nasa.jpf.jvm 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //
002:        // Copyright (C) 2005 United States Government as represented by the
003:        // Administrator of the National Aeronautics and Space Administration
004:        // (NASA).  All Rights Reserved.
005:        // 
006:        // This software is distributed under the NASA Open Source Agreement
007:        // (NOSA), version 1.3.  The NOSA has been approved by the Open Source
008:        // Initiative.  See the file NOSA-1.3-JPF at the top of the distribution
009:        // directory tree for the complete NOSA document.
010:        // 
011:        // THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY
012:        // KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT
013:        // LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO
014:        // SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
015:        // A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT
016:        // THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT
017:        // DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE.
018:        //
019:        package gov.nasa.jpf.jvm;
020:
021:        import org.apache.bcel.classfile.*;
022:
023:        /**
024:         * type, name and attribute information of a field.
025:         */
026:        public abstract class FieldInfo {
027:            /**
028:             * Name of the field.
029:             */
030:            protected final String name;
031:
032:            /**
033:             * Type of the field.
034:             */
035:            protected final String type;
036:
037:            /**
038:             * Class the field belongs to.
039:             */
040:            protected final ClassInfo ci;
041:
042:            /**
043:             * Static field.
044:             */
045:            protected final boolean isStatic;
046:
047:            /**
048:             * the (possibly null) initializer value for this field.
049:             */
050:            protected final ConstantValue cv;
051:
052:            /**
053:             * what is the order of declaration of this field
054:             */
055:            int fieldIndex;
056:
057:            /**
058:             * where in the corresponding Fields object do we store the value
059:             * (note this works because of the wonderful single inheritance)
060:             */
061:            int storageOffset;
062:
063:            /**
064:             * high 16 bit: non-propagation relevant field attributes
065:             * low 16 bit: object attribute propagation mask
066:             */
067:            int attributes = ElementInfo.ATTR_PROP_MASK;
068:
069:            protected FieldInfo(String name, String type, boolean isStatic,
070:                    ConstantValue cv, ClassInfo ci, int idx, int off) {
071:                this .name = name;
072:                this .type = type;
073:                this .isStatic = isStatic;
074:                this .ci = ci;
075:                this .cv = cv;
076:                this .fieldIndex = idx;
077:                this .storageOffset = off;
078:            }
079:
080:            public static FieldInfo create(Field f, ClassInfo ci, int idx,
081:                    int off) {
082:                return create(f.getName(), f.getSignature(), f.isStatic(), f
083:                        .getConstantValue(), ci, idx, off);
084:            }
085:
086:            /**
087:             * create the correct kind of FieldInfo with respect to <code>type</code>
088:             *
089:             * @param name the name of the field
090:             * @param type the type of the field
091:             * @param isStatic the staticness of teh field
092:             * @param cv the constant initializer for the field (possibly null)
093:             * @param ci the class of the field
094:             * @return the right kind of FieldInfo
095:             */
096:            public static FieldInfo create(String name, String type,
097:                    boolean isStatic, ConstantValue cv, ClassInfo ci, int idx,
098:                    int off) {
099:                switch (Types.getBaseType(type)) {
100:                case Types.T_CHAR:
101:                case Types.T_BYTE:
102:                case Types.T_INT:
103:                case Types.T_SHORT:
104:                case Types.T_BOOLEAN:
105:                    return new IntegerFieldInfo(name, type, isStatic, cv, ci,
106:                            idx, off);
107:
108:                case Types.T_FLOAT:
109:                    return new FloatFieldInfo(name, type, isStatic, cv, ci,
110:                            idx, off);
111:
112:                case Types.T_DOUBLE:
113:                    return new DoubleFieldInfo(name, type, isStatic, cv, ci,
114:                            idx, off);
115:
116:                case Types.T_LONG:
117:                    return new LongFieldInfo(name, type, isStatic, cv, ci, idx,
118:                            off);
119:
120:                case Types.T_ARRAY:
121:                case Types.T_REFERENCE:
122:                    return new ReferenceFieldInfo(name, type, isStatic, cv, ci,
123:                            idx, off);
124:
125:                default:
126:                    throw new InternalError("bad base type! " + type + " "
127:                            + Types.getBaseType(type));
128:                }
129:            }
130:
131:            public abstract String valueToString(Fields f);
132:
133:            /**
134:             * Returns the class that this field is associated with.
135:             */
136:            public ClassInfo getClassInfo() {
137:                return ci;
138:            }
139:
140:            public ConstantValue getConstantValue() {
141:                return cv;
142:            }
143:
144:            public int getFieldIndex() {
145:                return fieldIndex;
146:            }
147:
148:            public boolean isReference() {
149:                return false;
150:            }
151:
152:            public boolean isArrayField() {
153:                return false;
154:            }
155:
156:            /**
157:             * is this a static field? Counter productive to the current class struct,
158:             * but at some point we want to get rid of the Dynamic/Static branch (it's
159:             * really just a field attribute)
160:             */
161:            public boolean isStatic() {
162:                return isStatic;
163:            }
164:
165:            /**
166:             * Returns the name of the field.
167:             */
168:            public String getName() {
169:                return name;
170:            }
171:
172:            /**
173:             * @return the storage size of this field, @see Types.getTypeSize
174:             */
175:            public int getStorageSize() {
176:                return Types.getTypeSize(type);
177:            }
178:
179:            /**
180:             * Returns the type of the field.
181:             */
182:            public String getType() {
183:                return type;
184:            }
185:
186:            /**
187:             * initialize the corresponding data in the provided Fields instance
188:             */
189:            public abstract void initialize(Fields f);
190:
191:            /**
192:             * Returns a string representation of the field.
193:             */
194:            public String toString() {
195:                StringBuffer sb = new StringBuffer();
196:
197:                if (isStatic) {
198:                    sb.append("static ");
199:                }
200:
201:                sb.append(Types.getTypeName(type));
202:                sb.append(" ");
203:                sb.append(ci.getName());
204:                sb.append(".");
205:                sb.append(name);
206:
207:                return sb.toString();
208:            }
209:
210:            void setAttributes(int a) {
211:                attributes = a;
212:            }
213:
214:            public int getAttributes() {
215:                return attributes;
216:            }
217:
218:            public int getStorageOffset() {
219:                return storageOffset;
220:            }
221:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.