Source Code Cross Referenced for AbstractDecisionProcedure.java in  » Testing » KeY » de » uka » ilkd » key » proof » decproc » 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.proof.decproc 
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.proof.decproc;
012:
013:        import java.io.BufferedReader;
014:        import java.io.IOException;
015:        import java.io.InputStream;
016:        import java.io.InputStreamReader;
017:        import java.util.Calendar;
018:
019:        import de.uka.ilkd.key.java.Services;
020:        import de.uka.ilkd.key.logic.Constraint;
021:        import de.uka.ilkd.key.proof.Goal;
022:        import de.uka.ilkd.key.proof.Node;
023:
024:        /**
025:         * Abstract base class for decision procedure wrappers.
026:         * Provides common functionality for the ICS and Simplify wrappers.
027:         */
028:        public abstract class AbstractDecisionProcedure {
029:
030:            protected final Goal goal;
031:            protected final Constraint userConstraint;
032:            protected final DecisionProcedureTranslationFactory dptf;
033:            protected final Services services;
034:            protected final Node node;
035:
036:            public AbstractDecisionProcedure(Goal goal,
037:                    Constraint userConstraint,
038:                    DecisionProcedureTranslationFactory dptf, Services services) {
039:                this .goal = goal;
040:                this .node = goal.node();
041:                this .userConstraint = userConstraint;
042:                this .dptf = dptf;
043:                this .services = services;
044:            }
045:
046:            public AbstractDecisionProcedure(Node node,
047:                    Constraint userConstraint,
048:                    DecisionProcedureTranslationFactory dptf, Services services) {
049:                this .goal = null;
050:                this .node = node;
051:                this .userConstraint = userConstraint;
052:                this .dptf = dptf;
053:                this .services = services;
054:            }
055:
056:            /**
057:             * the method responsible for making various calls to the underlying
058:             * decision procedure with different Constraints
059:             * @param lightWeight true iff only quantifier free formulas shall be
060:             * considered.
061:             */
062:            public DecisionProcedureResult run(boolean lightWeight) {
063:                ConstraintSet constraintSet = new ConstraintSet(node.sequent(),
064:                        userConstraint);
065:                Constraint internalConstraint = constraintSet
066:                        .chooseConstraintSet();
067:                DecisionProcedureResult res = runInternal(constraintSet,
068:                        lightWeight);
069:                if (res.getResult()) {
070:                    return res;
071:                } else {
072:                    if (constraintSet.addUserConstraint(userConstraint)) {
073:                        return runInternal(constraintSet, lightWeight);
074:                    } else {
075:                        return res;
076:                    }
077:                }
078:
079:            }
080:
081:            /**
082:             * the method responsible for making various calls to the underlying
083:             * decision procedure with different Constraints
084:             */
085:            public DecisionProcedureResult run() {
086:                return run(false);
087:            }
088:
089:            /**
090:             * Invokes the actual decision procedure. This method is responsible for
091:             * translating to the syntax of the external tool, as well as passing this
092:             * as input to the tool and capturing its.
093:             */
094:            protected abstract DecisionProcedureResult runInternal(
095:                    ConstraintSet constraintSet, boolean lightWeight);
096:
097:            private static String toStringLeadingZeros(int n, int width) {
098:                String rv = "" + n;
099:                while (rv.length() < width) {
100:                    rv = "0" + rv;
101:                }
102:                return rv;
103:            }
104:
105:            /**
106:             * Constructs a date for use in log filenames.
107:             */
108:            protected static String getCurrentDateString() {
109:                Calendar c = Calendar.getInstance();
110:                StringBuffer sb = new StringBuffer();
111:                String dateSeparator = "-";
112:                String dateTimeSeparator = "_";
113:                sb.append(toStringLeadingZeros(c.get(Calendar.YEAR), 4))
114:                        .append(dateSeparator).append(
115:                                toStringLeadingZeros(c.get(Calendar.MONTH) + 1,
116:                                        2)).append(dateSeparator).append(
117:                                toStringLeadingZeros(c.get(Calendar.DATE), 2))
118:                        .append(dateTimeSeparator).append(
119:                                toStringLeadingZeros(c
120:                                        .get(Calendar.HOUR_OF_DAY), 2)
121:                                        + "h").append(
122:                                toStringLeadingZeros(c.get(Calendar.MINUTE), 2)
123:                                        + "m").append(
124:                                toStringLeadingZeros(c.get(Calendar.SECOND), 2)
125:                                        + "s").append('.').append(
126:                                toStringLeadingZeros(c
127:                                        .get(Calendar.MILLISECOND), 2));
128:                return sb.toString();
129:            }
130:
131:            /** Read the input until end of file and return contents in a
132:             * single string containing all line breaks. */
133:            protected static String read(InputStream in) throws IOException {
134:                String lineSeparator = System.getProperty("line.separator");
135:                BufferedReader reader = new BufferedReader(
136:                        new InputStreamReader(in));
137:                StringBuffer sb = new StringBuffer();
138:                String line;
139:                while ((line = reader.readLine()) != null) {
140:                    sb.append(line).append(lineSeparator);
141:                }
142:                return sb.toString();
143:            }
144:
145:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.