Source Code Cross Referenced for CatchAllStatement.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:
011:        package de.uka.ilkd.key.java.recoderext;
012:
013:        import recoder.java.*;
014:        import recoder.java.declaration.ParameterDeclaration;
015:        import recoder.java.statement.JavaStatement;
016:
017:        /**
018:         *  A shortcut-statement for a method body.
019:         */
020:
021:        public class CatchAllStatement extends JavaStatement implements 
022:                StatementContainer, ParameterContainer {
023:
024:            /**
025:             * the ast parent
026:             */
027:            private StatementContainer astParent;
028:
029:            protected StatementBlock body;
030:            protected ParameterDeclaration paramdecl;
031:
032:            /**
033:             *      Construct a method body shortcut
034:             *      @param r the ParameterDeclaration of the catch clause
035:             *      @param body the StatementBlock representing the catch clause's body     
036:             */
037:            public CatchAllStatement(ParameterDeclaration r, StatementBlock body) {
038:                this .body = body;
039:                paramdecl = r;
040:                makeParentRoleValid();
041:            }
042:
043:            public NonTerminalProgramElement getASTParent() {
044:                return astParent;
045:            }
046:
047:            public StatementContainer getStatementContainer() {
048:                return astParent;
049:            }
050:
051:            public int getStatementCount() {
052:                return (body == null) ? 0 : 1;
053:            }
054:
055:            public Statement getStatementAt(int i) {
056:                return (i == 0) ? body : null;
057:            }
058:
059:            public int getParameterDeclarationCount() {
060:                return (paramdecl == null) ? 0 : 1;
061:            }
062:
063:            public ParameterDeclaration getParameterDeclarationAt(int i) {
064:                return (i == 0) ? paramdecl : null;
065:            }
066:
067:            public void setStatementContainer(StatementContainer parent) {
068:                astParent = parent;
069:            }
070:
071:            /**
072:             *      Finds the source element that occurs first in the source.
073:             *      @return the last source element in the syntactical representation of
074:             *      this element, may be equals to this element.
075:             */
076:
077:            public SourceElement getFirstElement() {
078:                return getChildAt(0).getFirstElement();
079:            }
080:
081:            /**
082:             *      Finds the source element that occurs last in the source.
083:             *      @return the last source element in the syntactical representation of
084:             *      this element, may be equals to this element.
085:             */
086:
087:            public SourceElement getLastElement() {
088:                return getChildAt(getChildCount() - 1).getLastElement();
089:            }
090:
091:            /**
092:             *      Returns the number of children of this node.
093:             *      @return an int giving the number of children of this node
094:             */
095:
096:            public int getChildCount() {
097:                int result = 0;
098:                if (body != null)
099:                    result++;
100:                if (paramdecl != null)
101:                    result++;
102:                return result;
103:            }
104:
105:            /**
106:             *      Returns the child at the specified index in this node's "virtual"
107:             *      child array
108:             *      @param index an index into this node's "virtual" child array
109:             *      @return the program element at the given position
110:             *      @exception ArrayIndexOutOfBoundsException if <tt>index</tt> is out
111:             *                 of bounds
112:             */
113:
114:            public ProgramElement getChildAt(int index) {
115:                if (paramdecl != null) {
116:                    if (index == 0)
117:                        return paramdecl;
118:                    index--;
119:                }
120:                if (body != null) {
121:                    if (index == 0)
122:                        return body;
123:                    index--;
124:                }
125:                throw new ArrayIndexOutOfBoundsException();
126:            }
127:
128:            /**
129:             * Replace a single child in the current node.
130:             * The child to replace is matched by identity and hence must be known
131:             * exactly. The replacement element can be null - in that case, the child
132:             * is effectively removed.
133:             * The parent role of the new child is validated, while the
134:             * parent link of the replaced child is left untouched.
135:             * @param p the old child.
136:             * @param q the new child.
137:             * @return true if a replacement has occured, false otherwise.
138:             * @exception ClassCastException if the new child cannot take over
139:             *            the role of the old one.
140:             */
141:
142:            public boolean replaceChild(ProgramElement p, ProgramElement q) {
143:
144:                return false;
145:            }
146:
147:            /**
148:             *      Ensures that each child has "this" as syntactical parent.
149:             */
150:            public void makeParentRoleValid() {
151:                super .makeParentRoleValid();
152:                if (body != null) {
153:                    body.setStatementContainer(this );
154:                }
155:                if (paramdecl != null) {
156:                    paramdecl.setParameterContainer(this );
157:                }
158:            }
159:
160:            public int getChildPositionCode(ProgramElement child) {
161:                if (paramdecl == child) {
162:                    return 0;
163:                }
164:                if (body == child) {
165:                    return 1;
166:                }
167:                return -1;
168:            }
169:
170:            //don't think we need it
171:            public void accept(SourceVisitor v) {
172:                throw new IllegalStateException("Not implemented in "
173:                        + "CatchAllStatement");
174:            }
175:
176:            //don't think we need it
177:            public Object deepClone() {
178:                throw new IllegalStateException("Not implemented in "
179:                        + "CatchAllStatement");
180:            }
181:
182:            public String getName() {
183:                return "catchAll" + "(" + paramdecl + ") {" + body + " }";
184:            }
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.