Source Code Cross Referenced for PhiCatchStmt.java in  » Database-DBMS » db4o-6.4 » EDU » purdue » cs » bloat » tree » 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 » Database DBMS » db4o 6.4 » EDU.purdue.cs.bloat.tree 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Copyright (C) 2004 - 2007  db4objects Inc.  http://www.db4o.com
002:
003:        This file is part of the db4o open source object database.
004:
005:        db4o is free software; you can redistribute it and/or modify it under
006:        the terms of version 2 of the GNU General Public License as published
007:        by the Free Software Foundation and as clarified by db4objects' GPL 
008:        interpretation policy, available at
009:        http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
010:        Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
011:        Suite 350, San Mateo, CA 94403, USA.
012:
013:        db4o is distributed in the hope that it will be useful, but WITHOUT ANY
014:        WARRANTY; without even the implied warranty of MERCHANTABILITY or
015:        FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
016:        for more details.
017:
018:        You should have received a copy of the GNU General Public License along
019:        with this program; if not, write to the Free Software Foundation, Inc.,
020:        59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. */
021:        package EDU.purdue.cs.bloat.tree;
022:
023:        import java.util.*;
024:
025:        import EDU.purdue.cs.bloat.util.*;
026:
027:        /**
028:         * A PhiCatchStmt is used to handle variables that are used inside an exception
029:         * handler. Inside a try block a variable may be used several times. It may be
030:         * updated, may be invovled in a phi-function, etc. A PhiCatchStmt is placed at
031:         * the beginning of each expection handling (catch) block to factor together the
032:         * variables that are live within the protected region.
033:         */
034:        public class PhiCatchStmt extends PhiStmt {
035:            ArrayList operands;
036:
037:            /**
038:             * Constructor.
039:             * 
040:             * @param target
041:             *            Local variable to which the result of this phi-function is to
042:             *            be assigned.
043:             */
044:            public PhiCatchStmt(final LocalExpr target) {
045:                super (target);
046:                this .operands = new ArrayList();
047:            }
048:
049:            public void visitForceChildren(final TreeVisitor visitor) {
050:                if (visitor.reverse()) {
051:                    target.visit(visitor);
052:                }
053:
054:                for (int i = 0; i < operands.size(); i++) {
055:                    final LocalExpr expr = (LocalExpr) operands.get(i);
056:                    expr.visit(visitor);
057:                }
058:
059:                if (!visitor.reverse()) {
060:                    target.visit(visitor);
061:                }
062:            }
063:
064:            public void visit(final TreeVisitor visitor) {
065:                visitor.visitPhiCatchStmt(this );
066:            }
067:
068:            /**
069:             * Searches the list of operands for a local variable.
070:             * 
071:             * @param def
072:             *            The local variable definition to search for.
073:             * @return True, if def is found, otherwise, false.
074:             */
075:            public boolean hasOperandDef(final LocalExpr def) {
076:                for (int i = 0; i < operands.size(); i++) {
077:                    final LocalExpr expr = (LocalExpr) operands.get(i);
078:                    if (expr.def() == def) {
079:                        return true;
080:                    }
081:                }
082:
083:                return false;
084:            }
085:
086:            /**
087:             * Add a local variable to the operand list for this phi-function.
088:             * 
089:             * @param operand
090:             *            An operand of this phi-function.
091:             */
092:            public void addOperand(final LocalExpr operand) {
093:                for (int i = 0; i < operands.size(); i++) {
094:                    final LocalExpr expr = (LocalExpr) operands.get(i);
095:                    Assert.isTrue(expr.def() != operand.def());
096:                }
097:
098:                operands.add(operand);
099:                operand.setParent(this );
100:            }
101:
102:            /**
103:             * Returns the operands to this phi-function.
104:             */
105:            public Collection operands() {
106:                if (operands == null) {
107:                    return new ArrayList();
108:                }
109:
110:                for (int i = 0; i < operands.size(); i++) {
111:                    final LocalExpr ei = (LocalExpr) operands.get(i);
112:
113:                    for (int j = operands.size() - 1; j > i; j--) {
114:                        final LocalExpr ej = (LocalExpr) operands.get(j);
115:
116:                        if (ei.def() == ej.def()) {
117:                            ej.cleanup();
118:                            operands.remove(j);
119:                        }
120:                    }
121:                }
122:
123:                return operands;
124:            }
125:
126:            /**
127:             * Returns the number of operands to this phi-function.
128:             */
129:            public int numOperands() {
130:                return operands.size();
131:            }
132:
133:            /**
134:             * Sets the value of one of this phi-function's operands.
135:             * 
136:             * @param i
137:             *            The number parameter to set.
138:             * @param expr
139:             *            The new value of the parameter.
140:             */
141:            public void setOperandAt(final int i, final Expr expr) {
142:                final Expr old = (Expr) operands.get(i);
143:                old.cleanup();
144:                operands.set(i, expr);
145:                expr.setParent(this );
146:            }
147:
148:            /**
149:             * Returns the operand at a given index.
150:             */
151:            public Expr operandAt(final int i) {
152:                return (Expr) operands.get(i);
153:            }
154:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.