Source Code Cross Referenced for RKeYMetaConstructExpression.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:        // This file is taken from the RECODER library, which is protected by the LGPL,
012:        // and modified.
013:        /** This class is part of the AST RECODER builds when it parses and resolves Java
014:         * programs with meta constructs and schema variables. It is transformed by Recoder2KeY
015:         * to a subclass of ...rule.metaconstruct.ProgramMetaConstruct.
016:         */package de.uka.ilkd.key.java.recoderext;
017:
018:        import recoder.convenience.TreeWalker;
019:        import recoder.java.*;
020:        import recoder.java.expression.Literal;
021:
022:        public class RKeYMetaConstructExpression extends Literal implements 
023:                ExpressionContainer, KeYRecoderExtension {
024:
025:            /**
026:             Child
027:             */
028:            protected Expression child = null;
029:            protected String name = "";
030:
031:            protected RKeYMetaConstructExpression(
032:                    RKeYMetaConstructExpression proto) {
033:                super (proto);
034:                if (proto.child != null) {
035:                    child = (Expression) proto.child.deepClone();
036:                }
037:            }
038:
039:            public RKeYMetaConstructExpression() {
040:            }
041:
042:            /**
043:             Make parent role valid.
044:             */
045:            public void makeParentRoleValid() {
046:                if (child != null) {
047:                    child.setExpressionContainer(this );
048:                }
049:            }
050:
051:            /**
052:             Returns the number of children of this node.
053:             @return an int giving the number of children of this node
054:             */
055:            public int getChildCount() {
056:                int result = 0;
057:                if (child != null)
058:                    result++;
059:                return result;
060:            }
061:
062:            /**
063:             Returns the child at the specified index in this node's "virtual"
064:             child array
065:             @param index an index into this node's "virtual" child array
066:             @return the program element at the given position
067:             @exception ArrayIndexOutOfBoundsException if <tt>index</tt> is out
068:                        of bounds
069:             */
070:            public ProgramElement getChildAt(int index) {
071:                if (child != null) {
072:                    if (index == 0)
073:                        return child;
074:                }
075:                throw new ArrayIndexOutOfBoundsException();
076:            }
077:
078:            public int getChildPositionCode(ProgramElement child0) {
079:                // role 0: child
080:                if (child0 == child) {
081:                    return 0;
082:                }
083:                return -1;
084:            }
085:
086:            public int getIndexOfChild(ProgramElement pe) {
087:                if (pe == child) {
088:                    return 0;
089:                }
090:                return -1;
091:            }
092:
093:            public int getIndexOfChild(int posCode) {
094:                if (posCode == getChildPositionCode(child)) {
095:                    return 0;
096:                }
097:                return -1;
098:            }
099:
100:            public int getRoleOfChild(int i) {
101:                if (i == 0)
102:                    return getChildPositionCode(child);
103:                return -1;
104:            }
105:
106:            public void makeAllParentRolesValid() {
107:                TreeWalker tw = new TreeWalker(this );
108:                while (tw.next(NonTerminalProgramElement.class)) {
109:                    ((NonTerminalProgramElement) tw.getProgramElement())
110:                            .makeParentRoleValid();
111:                }
112:            }
113:
114:            public boolean replaceChild(ProgramElement p, ProgramElement q) {
115:                if (child == p) {
116:                    Expression r = (Expression) q;
117:                    child = r;
118:                    if (r != null) {
119:                        r.setExpressionContainer(this );
120:                    }
121:                    return true;
122:                }
123:                return false;
124:            }
125:
126:            /**
127:             * sets a String name of this meta construct like 'unwind-loop'
128:             * @param s the String
129:             */
130:            public void setName(String s) {
131:                name = s;
132:            }
133:
134:            /**
135:             * returns a String name of this meta construct.
136:             */
137:            public String getName() {
138:                return name;
139:            }
140:
141:            /**
142:             Get child.
143:             @return the expression.
144:             */
145:
146:            public Expression getChild() {
147:                return child;
148:            }
149:
150:            /**
151:             Set child.
152:             @param expression a expression.
153:             */
154:
155:            public void setChild(Expression expression) {
156:                child = expression;
157:            }
158:
159:            /**
160:             Get the number of expression in this container.
161:             @return the number of expressions.
162:             */
163:
164:            public int getExpressionCount() {
165:                return (child != null) ? 1 : 0;
166:            }
167:
168:            /*
169:              Return the expression at the specified index in this node's
170:              "virtual" expression array.
171:              @param index an index for a expression.
172:              @return the expression with the given index.
173:              @exception ArrayIndexOutOfBoundsException if <tt>index</tt> is out
174:              of bounds.
175:             */
176:
177:            public Expression getExpressionAt(int index) {
178:                if (child != null && index == 0) {
179:                    return child;
180:                }
181:                throw new ArrayIndexOutOfBoundsException();
182:            }
183:
184:            //don't think we need it
185:            public void accept(SourceVisitor v) {
186:            }
187:
188:            //???
189:            public Object deepClone() {
190:                return null;
191:            }
192:
193:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.