Source Code Cross Referenced for Switch.java in  » Testing » KeY » de » uka » ilkd » key » java » statement » 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.statement 
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.statement;
012:
013:        import de.uka.ilkd.key.java.*;
014:        import de.uka.ilkd.key.java.visitor.Visitor;
015:        import de.uka.ilkd.key.util.ExtList;
016:
017:        /**
018:         *  Switch.
019:         */
020:
021:        public class Switch extends BranchStatement implements 
022:                ExpressionContainer, VariableScope, TypeScope {
023:
024:            /**
025:             *      Branches.
026:             */
027:
028:            protected final ArrayOfBranch branches;
029:
030:            /**
031:             *      Expression.
032:             */
033:
034:            protected final Expression expression;
035:
036:            /**
037:             *      Switch.
038:             */
039:
040:            public Switch() {
041:                this .branches = null;
042:                this .expression = null;
043:            }
044:
045:            /**
046:             *      Switch.
047:             *      @param e an expression.
048:             */
049:
050:            public Switch(Expression e) {
051:                this .branches = null;
052:                this .expression = e;
053:            }
054:
055:            /**
056:             *      Switch.
057:             *      @param e an expression.
058:             *      @param branches a branch array
059:             */
060:
061:            public Switch(Expression e, Branch[] branches) {
062:                this .branches = new ArrayOfBranch(branches);
063:                this .expression = e;
064:            }
065:
066:            /**
067:             *      Switch.
068:             *      @param children a list with all children
069:             */
070:
071:            public Switch(ExtList children) {
072:                super (children);
073:                this .expression = (Expression) children.get(Expression.class);
074:                this .branches = new ArrayOfBranch((Branch[]) children
075:                        .collect(Branch.class));
076:            }
077:
078:            /**
079:             *      Returns the number of children of this node.
080:             *      @return an int giving the number of children of this node
081:             */
082:
083:            public int getChildCount() {
084:                int result = 0;
085:                if (expression != null)
086:                    result++;
087:                if (branches != null)
088:                    result += branches.size();
089:                return result;
090:            }
091:
092:            /**
093:             *      Returns the child at the specified index in this node's "virtual"
094:             *      child array
095:             *      @param index an index into this node's "virtual" child array
096:             *      @return the program element at the given position
097:             *      @exception ArrayIndexOutOfBoundsException if <tt>index</tt> is out
098:             *                 of bounds
099:             */
100:
101:            public ProgramElement getChildAt(int index) {
102:                if (expression != null) {
103:                    if (index == 0)
104:                        return expression;
105:                    index--;
106:                }
107:                if (branches != null) {
108:                    return branches.getBranch(index);
109:                }
110:                throw new ArrayIndexOutOfBoundsException();
111:            }
112:
113:            /**
114:             *      Get the number of expressions in this container.
115:             *      @return the number of expressions.
116:             */
117:
118:            public int getExpressionCount() {
119:                return (expression != null) ? 1 : 0;
120:            }
121:
122:            /*
123:              Return the expression at the specified index in this node's
124:              "virtual" expression array.
125:              @param index an index for an expression.
126:              @return the expression with the given index.
127:              @exception ArrayIndexOutOfBoundsException if <tt>index</tt> is out
128:              of bounds.
129:             */
130:
131:            public Expression getExpressionAt(int index) {
132:                if (expression != null && index == 0) {
133:                    return expression;
134:                }
135:                throw new ArrayIndexOutOfBoundsException();
136:            }
137:
138:            /**
139:             *      Get expression.
140:             *      @return the expression.
141:             */
142:
143:            public Expression getExpression() {
144:                return expression;
145:            }
146:
147:            /**
148:             *      Get the number of branches in this container.
149:             *      @return the number of branches.
150:             */
151:
152:            public int getBranchCount() {
153:                return (branches != null) ? branches.size() : 0;
154:            }
155:
156:            /*
157:              Return the branch at the specified index in this node's
158:              "virtual" branch array.
159:              @param index an index for a branch.
160:              @return the branch with the given index.
161:              @exception ArrayIndexOutOfBoundsException if <tt>index</tt> is out
162:              of bounds.
163:             */
164:
165:            public Branch getBranchAt(int index) {
166:                if (branches != null) {
167:                    return branches.getBranch(index);
168:                }
169:                throw new ArrayIndexOutOfBoundsException();
170:            }
171:
172:            /* Return the branch array wrapper
173:             * @return the array wrapper of the branches
174:             */
175:            public ArrayOfBranch getBranchList() {
176:                return branches;
177:            }
178:
179:            /** calls the corresponding method of a visitor in order to
180:             * perform some action/transformation on this element
181:             * @param v the Visitor
182:             */
183:            public void visit(Visitor v) {
184:                v.performActionOnSwitch(this );
185:            }
186:
187:            public void prettyPrint(PrettyPrinter p) throws java.io.IOException {
188:                p.printSwitch(this);
189:            }
190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.