Source Code Cross Referenced for ThrownExceptionFeature.java in  » Testing » KeY » de » uka » ilkd » key » strategy » feature » 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.strategy.feature 
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:        package de.uka.ilkd.key.strategy.feature;
009:
010:        import java.util.ArrayList;
011:        import java.util.List;
012:
013:        import de.uka.ilkd.key.java.JavaInfo;
014:        import de.uka.ilkd.key.java.ProgramElement;
015:        import de.uka.ilkd.key.java.Services;
016:        import de.uka.ilkd.key.java.Statement;
017:        import de.uka.ilkd.key.java.abstraction.KeYJavaType;
018:        import de.uka.ilkd.key.java.reference.ExecutionContext;
019:        import de.uka.ilkd.key.java.statement.Throw;
020:        import de.uka.ilkd.key.logic.PosInOccurrence;
021:        import de.uka.ilkd.key.logic.PosInProgram;
022:        import de.uka.ilkd.key.logic.ProgramPrefix;
023:        import de.uka.ilkd.key.logic.Term;
024:        import de.uka.ilkd.key.logic.op.Modality;
025:        import de.uka.ilkd.key.logic.sort.Sort;
026:        import de.uka.ilkd.key.proof.Goal;
027:        import de.uka.ilkd.key.rule.RuleApp;
028:        import de.uka.ilkd.key.rule.TacletApp;
029:
030:        public class ThrownExceptionFeature extends BinaryFeature {
031:
032:            public static Feature create(String[] blockedExceptions,
033:                    Services services) {
034:                return new ThrownExceptionFeature(blockedExceptions, services);
035:            }
036:
037:            private final Sort[] filteredExceptions;
038:
039:            /**
040:             * creates a feature filtering first active throw statements where the
041:             * thrown exception is of one of the given types (or their subtypes)
042:             * 
043:             * @param p_filteredExceptions
044:             *            the String array with the types of the thrown exceptions
045:             * @param services
046:             *            the Services
047:             */
048:            private ThrownExceptionFeature(String[] p_filteredExceptions,
049:                    Services services) {
050:                final List filtered = new ArrayList();
051:
052:                final JavaInfo javaInfo = services.getJavaInfo();
053:
054:                for (int i = 0; i < p_filteredExceptions.length; i++) {
055:                    final KeYJavaType nullPointer = javaInfo
056:                            .getKeYJavaType(p_filteredExceptions[i]);
057:                    if (nullPointer != null) {
058:                        filtered.add(nullPointer.getSort());
059:                    }
060:                }
061:                filteredExceptions = (Sort[]) filtered
062:                        .toArray(new Sort[filtered.size()]);
063:            }
064:
065:            private boolean blockedExceptions(Sort excType) {
066:                for (int i = 0; i < filteredExceptions.length; i++) {
067:                    if (excType.extendsTrans(filteredExceptions[i])) {
068:                        return true;
069:                    }
070:                }
071:                return false;
072:            }
073:
074:            protected boolean filter(RuleApp app, PosInOccurrence pos, Goal goal) {
075:                return app instanceof  TacletApp ? filter(pos.subTerm(), goal
076:                        .proof().getServices(), ((TacletApp) app)
077:                        .instantiations().getExecutionContext()) : false;
078:            }
079:
080:            protected boolean filter(Term term, Services services,
081:                    ExecutionContext ec) {
082:                if (term.op() instanceof  Modality) {
083:                    final ProgramElement fstActive = getFirstExecutableStatement(term);
084:                    return fstActive instanceof  Throw
085:                            && blockedExceptions(((Throw) fstActive)
086:                                    .getExpressionAt(0).getKeYJavaType(
087:                                            services, ec).getSort());
088:                }
089:                return false;
090:            }
091:
092:            /**
093:             * returns the first executable statement (often identical with the first
094:             * active statement)
095:             * 
096:             * @param term
097:             *            the Term with the program at top level
098:             * @return the first executable statement
099:             */
100:            private ProgramElement getFirstExecutableStatement(Term term) {
101:                if (term.javaBlock().isEmpty())
102:                    return null;
103:
104:                final ProgramElement jb = term.javaBlock().program();
105:                final ProgramElement fstActive;
106:
107:                if (jb instanceof  ProgramPrefix) {
108:                    final ProgramPrefix pp = ((ProgramPrefix) jb)
109:                            .getPrefixElementAt(((ProgramPrefix) jb)
110:                                    .getPrefixLength() - 1);
111:                    fstActive = (Statement) PosInProgram.getProgramAt(pp
112:                            .getFirstActiveChildPos(), pp);
113:                } else {
114:                    fstActive = jb;
115:                }
116:                return fstActive;
117:            }
118:
119:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.