Source Code Cross Referenced for GfAstNode.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:        /**
019:         * @author daniels
020:         * This Class represents a parsed node in the GF AST.
021:         * It knows about types, bound variables, funs.
022:         * But nothing about printnames. That's what AstNodeData is for.
023:         */
024:        class GfAstNode {
025:            /**
026:             * contains the types of the bound variables in the order of their occurence
027:             */
028:            protected final String[] boundTypes;
029:            /**
030:             * contains the names of the bound variables in the order of their occurence
031:             */
032:            protected final String[] boundNames;
033:            /** 
034:             * The type of this AST node 
035:             */
036:            private final String type;
037:
038:            /**
039:             * @return The type of this AST node
040:             */
041:            protected String getType() {
042:                return type;
043:            }
044:
045:            /** 
046:             * the fun represented in this AST node 
047:             */
048:            private final String fun;
049:
050:            /**
051:             * @return the fun represented in this AST node.
052:             * Can be a metavariable like "?1"
053:             */
054:            protected String getFun() {
055:                return fun;
056:            }
057:
058:            /**
059:             * @return true iff the node is a metavariable, i.e. open and not
060:             * yet refined.
061:             */
062:            protected boolean isMeta() {
063:                return fun.startsWith("?");
064:            }
065:
066:            /** 
067:             * the line that was used to build this node 
068:             */
069:            private final String line;
070:
071:            /**
072:             * @return the line that was used to build this node
073:             */
074:            protected String getLine() {
075:                return line;
076:            }
077:
078:            /**
079:             * The constraint attached to this node
080:             */
081:            public final String constraint;
082:
083:            /**
084:             * feed this constructor the line that appears in the GF AST and
085:             * it will get chopped at the right points.
086:             * @param line The line from GF without the * in the beginning.
087:             */
088:            protected GfAstNode(final String line) {
089:                this .line = line.trim();
090:                final int index = this .line.lastIndexOf(" : ");
091:                String typeString = this .line.substring(index + 3);
092:                final int constraintIndex = typeString.indexOf(" {");
093:                if (constraintIndex > -1) {
094:                    this .constraint = typeString.substring(constraintIndex + 1)
095:                            .trim();
096:                    this .type = typeString.substring(0, constraintIndex).trim();
097:                } else {
098:                    this .constraint = "";
099:                    this .type = typeString;
100:                }
101:                String myFun = this .line.substring(0, index);
102:                if (myFun.startsWith("\\(")) {
103:                    final int end = myFun.lastIndexOf(") -> ");
104:                    String boundPart = myFun.substring(2, end);
105:                    String[] bounds = boundPart.split("\\)\\s*\\,\\s*\\(");
106:                    this .boundNames = new String[bounds.length];
107:                    this .boundTypes = new String[bounds.length];
108:                    for (int i = 0; i < bounds.length; i++) {
109:                        //System.out.print("+" + bounds[i] + "-");
110:                        int colon = bounds[i].indexOf(" : ");
111:                        this .boundNames[i] = bounds[i].substring(0, colon);
112:                        this .boundTypes[i] = bounds[i].substring(colon + 3);
113:                        //System.out.println(boundNames[i] + " ;; " + boundTypes[i]);
114:                    }
115:                    myFun = myFun.substring(end + 5);
116:                } else {
117:                    this .boundNames = new String[0];
118:                    this .boundTypes = new String[0];
119:                }
120:                this .fun = myFun;
121:            }
122:
123:            public String toString() {
124:                return this.line;
125:            }
126:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.