Source Code Cross Referenced for ExecutionContext.java in  » Testing » KeY » de » uka » ilkd » key » java » recoderext » 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 » KeY » de.uka.ilkd.key.java.recoderext 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // This file is part of KeY - Integrated Deductive Software Design
002:        // Copyright (C) 2001-2007 Universitaet Karlsruhe, Germany
003:        //                         Universitaet Koblenz-Landau, Germany
004:        //                         Chalmers University of Technology, Sweden
005:        //
006:        // The KeY system is protected by the GNU General Public License. 
007:        // See LICENSE.TXT for details.
008:        //
009:        //
010:        package de.uka.ilkd.key.java.recoderext;
011:
012:        import recoder.java.*;
013:        import recoder.java.reference.ReferencePrefix;
014:        import recoder.java.reference.TypeReference;
015:        import recoder.java.reference.TypeReferenceContainer;
016:
017:        public class ExecutionContext extends JavaNonTerminalProgramElement
018:                implements  Reference, TypeReferenceContainer,
019:                ExpressionContainer {
020:
021:            /**
022:             * the ast parent
023:             */
024:            private NonTerminalProgramElement astParent;
025:
026:            /**
027:             * the class context 
028:             */
029:            private TypeReference classContext;
030:
031:            /**
032:             * the reference to the active object
033:             */
034:            private ReferencePrefix runtimeInstance;
035:
036:            protected ExecutionContext() {
037:            }
038:
039:            /**
040:             * creates an execution context reference
041:             * @param classContext the TypeReference refering to the next enclosing
042:             * class 
043:             * @param runtimeInstance a ReferencePrefix to the object that
044:             * is currently active/executed
045:             */
046:            public ExecutionContext(TypeReference classContext,
047:                    ReferencePrefix runtimeInstance) {
048:                this .classContext = classContext;
049:                this .runtimeInstance = runtimeInstance;
050:                makeParentRoleValid();
051:            }
052:
053:            /**
054:             * Returns the number of children of this node.
055:             * @return an int giving the number of children of this node
056:             */
057:            public int getChildCount() {
058:                int count = 0;
059:                if (runtimeInstance != null)
060:                    count++;
061:                if (classContext != null)
062:                    count++;
063:                return count;
064:            }
065:
066:            /**
067:             * Returns the child at the specified index in this node's "virtual"
068:             * child array.
069:             * @param index an index into this node's "virtual" child array
070:             * @return the program element at the given position
071:             * @exception ArrayIndexOutOfBoundsException if <tt>index</tt> is out
072:             *    of bounds
073:             */
074:            public ProgramElement getChildAt(int index) {
075:                if (classContext != null) {
076:                    if (index == 0)
077:                        return classContext;
078:                    index--;
079:                }
080:                if (runtimeInstance != null) {
081:                    if (index == 0)
082:                        return runtimeInstance;
083:                    index--;
084:                }
085:                throw new ArrayIndexOutOfBoundsException();
086:            }
087:
088:            /**
089:             * Returns the positional code of the given child
090:             * @param child the exact child to look for.
091:             * @return the positional code of the given child, or <CODE>-1</CODE>.
092:             */
093:            public int getChildPositionCode(ProgramElement child) {
094:                if (child != null) {
095:                    if (child == classContext)
096:                        return 0;
097:                }
098:                if (runtimeInstance != null) {
099:                    if (child == runtimeInstance)
100:                        return (1 << 4 | 1);
101:                }
102:                return -1;
103:            }
104:
105:            public void accept(SourceVisitor visitor) {
106:            }
107:
108:            public Object deepClone() {
109:                return new ExecutionContext(classContext, runtimeInstance);
110:            }
111:
112:            public NonTerminalProgramElement getASTParent() {
113:                return astParent;
114:            }
115:
116:            public void setParent(NonTerminalProgramElement parent) {
117:                astParent = parent;
118:            }
119:
120:            public boolean replaceChild(recoder.java.ProgramElement child,
121:                    recoder.java.ProgramElement newChild) {
122:                if (child == classContext) {
123:                    classContext = (TypeReference) newChild;
124:                } else if (child == runtimeInstance) {
125:                    runtimeInstance = (ReferencePrefix) newChild;
126:                } else {
127:                    return false;
128:                }
129:                makeParentRoleValid();
130:                return true;
131:            }
132:
133:            /**
134:             *      Ensures that each child has "this" as syntactical parent.
135:             */
136:            public void makeParentRoleValid() {
137:                super .makeParentRoleValid();
138:                if (classContext != null) {
139:                    classContext.setParent(this );
140:                }
141:                if (runtimeInstance != null) {
142:                    ((Expression) runtimeInstance).setExpressionContainer(this );
143:                }
144:            }
145:
146:            public TypeReference getTypeReferenceAt(int index) {
147:                if (classContext != null && index == 0) {
148:                    return classContext;
149:                }
150:                throw new ArrayIndexOutOfBoundsException();
151:            }
152:
153:            public int getTypeReferenceCount() {
154:                return classContext == null ? 0 : 1;
155:            }
156:
157:            public Expression getExpressionAt(int index) {
158:                if (runtimeInstance != null && index == 0) {
159:                    return (Expression) runtimeInstance;
160:                }
161:                throw new ArrayIndexOutOfBoundsException();
162:            }
163:
164:            public int getExpressionCount() {
165:                return runtimeInstance == null ? 0 : 1;
166:            }
167:
168:            /**
169:             * returns the type reference to the next enclosing class
170:             * @return the type reference to the next enclosing class
171:             */
172:            public TypeReference getTypeReference() {
173:                return classContext;
174:            }
175:
176:            /**
177:             * returns the runtime instance object
178:             * @return the runtime instance object
179:             */
180:            public ReferencePrefix getRuntimeInstance() {
181:                return runtimeInstance;
182:            }
183:
184:            public void prettyPrint(PrettyPrinter p) throws java.io.IOException {
185:            }
186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.