Source Code Cross Referenced for AbstractProber.java in  » Testing » KeY » de » uka » ilkd » key » ocl » gf » 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.ocl.gf 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //Copyright (c) Hans-Joachim Daniels 2005
002:        //
003:        //This program is free software; you can redistribute it and/or modify
004:        //it under the terms of the GNU General Public License as published by
005:        //the Free Software Foundation; either version 2 of the License, or
006:        //(at your option) any later version.
007:        //
008:        //This program is distributed in the hope that it will be useful,
009:        //but WITHOUT ANY WARRANTY; without even the implied warranty of
010:        //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
011:        //GNU General Public License for more details.
012:        //
013:        //You can either finde the file LICENSE or LICENSE.TXT in the source 
014:        //distribution or in the .jar file of this application
015:
016:        package de.uka.ilkd.key.ocl.gf;
017:
018:        import java.io.IOException;
019:        import java.util.logging.Level;
020:        import java.util.logging.Logger;
021:
022:        /**
023:         * A class that offers a basic readGfEdit method with a lot of
024:         * hot spots where subclasses can plug in 
025:         * @author daniels
026:         *
027:         */
028:        abstract class AbstractProber {
029:            /**
030:             * reference to the editor whose readRefinementMenu method is used
031:             */
032:            protected final GfCapsule gfCapsule;
033:            protected static Logger logger = Logger
034:                    .getLogger(AbstractProber.class.getName());
035:
036:            /**
037:             * A constructor which sets some fields
038:             * @param gfCapsule The encapsulation of GF
039:             */
040:            public AbstractProber(GfCapsule gfCapsule) {
041:                this .gfCapsule = gfCapsule;
042:            }
043:
044:            /**
045:             * reads the hmsg part
046:             * @param readresult the first line
047:             * @return the first line of the next XML child.
048:             * if no hmsg is present @see readresult is returned.
049:             */
050:            protected String readHmsg(String readresult) {
051:                if (readresult.equals("<hmsg>")) {
052:                    gfCapsule.skipChild("<hmsg>");
053:                    try {
054:                        String next = gfCapsule.fromProc.readLine();
055:                        if (logger.isLoggable(Level.FINER)) {
056:                            logger.finer("2 " + next);
057:                        }
058:                        return next;
059:                    } catch (IOException e) {
060:                        System.err
061:                                .println("Could not read from external process:\n"
062:                                        + e);
063:                        return "";
064:                    }
065:                } else {
066:                    return readresult;
067:                }
068:            }
069:
070:            /**
071:             * reads the linearization subtree.
072:             * The first line should be already read
073:             * @param readresult the first line with the opening tag
074:             */
075:            protected void readLinearizations(String readresult) {
076:                gfCapsule.skipChild("<linearizations>");
077:            }
078:
079:            /** 
080:             * Reads the tree child of the XML from beginning to end 
081:             */
082:            protected void readTree() {
083:                gfCapsule.skipChild("<tree>");
084:            }
085:
086:            /** 
087:             * Reads the message child of the XML from beginning to end 
088:             */
089:            protected void readMessage() {
090:                gfCapsule.skipChild("<message>");
091:            }
092:
093:            /** 
094:             * Reads the menu child of the XML from beginning to end 
095:             */
096:            protected void readMenu() {
097:                gfCapsule.skipChild("<menu>");
098:            }
099:
100:            /**
101:             * reads the output from GF starting with &gt;gfedit&lt; 
102:             * and last reads &gt;/gfedit&lt;. 
103:             */
104:            protected void readGfedit() {
105:                try {
106:                    String next = "";
107:                    //read <gfedit>
108:                    String readresult = gfCapsule.fromProc.readLine();
109:                    if (logger.isLoggable(Level.FINER)) {
110:                        logger.finer("1 " + next);
111:                    }
112:                    //read either <hsmg> or <lineatization>
113:                    readresult = gfCapsule.fromProc.readLine();
114:                    if (logger.isLoggable(Level.FINER)) {
115:                        logger.finer("1 " + next);
116:                    }
117:
118:                    Hmsg hmsg = gfCapsule.readHmsg(readresult);
119:                    next = hmsg.lastline;
120:
121:                    //in case there comes sth. unexpected before <linearizations>
122:                    //usually the while body is never entered
123:                    // %%%
124:                    while ((next != null)
125:                            && ((next.length() == 0) || (!next.trim().equals(
126:                                    "<linearizations>")))) {
127:                        next = gfCapsule.fromProc.readLine();
128:                        if (next != null) {
129:                            if (logger.isLoggable(Level.FINER)) {
130:                                logger.finer("1 " + next);
131:                            }
132:                        } else {
133:                            System.exit(0);
134:                        }
135:                    }
136:                    readLinearizations(next);
137:                    readTree();
138:                    readMessage();
139:                    readMenu();
140:
141:                    for (int i = 0; i < 3 && !next.equals(""); i++) {
142:                        next = gfCapsule.fromProc.readLine();
143:                        if (logger.isLoggable(Level.FINER)) {
144:                            logger.finer("1 " + next);
145:                        }
146:                    }
147:
148:                } catch (IOException e) {
149:                    System.err
150:                            .println("Could not read from external process:\n"
151:                                    + e);
152:                }
153:
154:            }
155:
156:            /**
157:             * send a command to GF
158:             * @param text the command, exactly the string that is going to be sent
159:             */
160:            protected void send(String text) {
161:                if (logger.isLoggable(Level.FINE)) {
162:                    logger.fine("## send: '" + text + "'");
163:                }
164:                gfCapsule.realSend(text);
165:            }
166:
167:            /**
168:             * Just reads the complete output of a GF run and ignores it.	 
169:             */
170:            protected void readAndIgnore() {
171:                try {
172:                    StringBuffer debugCollector = new StringBuffer();
173:                    String readresult = gfCapsule.fromProc.readLine();
174:                    debugCollector.append(readresult).append('\n');
175:                    if (logger.isLoggable(Level.FINER))
176:                        logger.finer("14 " + readresult);
177:                    while (readresult.indexOf("</gfedit>") == -1) {
178:                        readresult = gfCapsule.fromProc.readLine();
179:                        debugCollector.append(readresult).append('\n');
180:                        if (logger.isLoggable(Level.FINER))
181:                            logger.finer("14 " + readresult);
182:                    }
183:                    //read trailing newline:	 
184:                    readresult = gfCapsule.fromProc.readLine();
185:                    debugCollector.append(readresult).append('\n');
186:                    if (logger.isLoggable(Level.FINER))
187:                        logger.finer("14 " + readresult);
188:
189:                } catch (IOException e) {
190:                    System.err
191:                            .println("Could not read from external process:\n"
192:                                    + e);
193:                }
194:            }
195:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.