Source Code Cross Referenced for LDT.java in  » Testing » KeY » de » uka » ilkd » key » logic » ldt » 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.logic.ldt 
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:        package de.uka.ilkd.key.logic.ldt;
011:
012:        import java.util.HashMap;
013:
014:        import de.uka.ilkd.key.java.Expression;
015:        import de.uka.ilkd.key.java.Services;
016:        import de.uka.ilkd.key.java.abstraction.*;
017:        import de.uka.ilkd.key.java.expression.Literal;
018:        import de.uka.ilkd.key.java.reference.ExecutionContext;
019:        import de.uka.ilkd.key.logic.Name;
020:        import de.uka.ilkd.key.logic.Named;
021:        import de.uka.ilkd.key.logic.Namespace;
022:        import de.uka.ilkd.key.logic.Term;
023:        import de.uka.ilkd.key.logic.op.Function;
024:        import de.uka.ilkd.key.logic.sort.Sort;
025:        import de.uka.ilkd.key.rule.SetAsListOfTaclet;
026:        import de.uka.ilkd.key.rule.SetOfTaclet;
027:        import de.uka.ilkd.key.util.ExtList;
028:
029:        /** this class extends the class ADT and is used to represent language
030:         * datatype models e.g. a model for the java type int, boolean etc.
031:         * It contains the necessary function symbols, sorts and Taclets. The
032:         * class TypeConverter needs this class to convert java-program
033:         * constructs to logic terms.
034:         */
035:        public abstract class LDT extends ADT {
036:
037:            /** the function namespace */
038:            private Namespace functions = new Namespace();
039:
040:            /** the model specific rules */
041:            private SetOfTaclet rules = SetAsListOfTaclet.EMPTY_SET;
042:
043:            /** the sort represented by the LDT */
044:            protected final Sort sort;
045:
046:            /** 
047:             * one LDT may model several program types; this is the list
048:             * of these types
049:             */
050:            protected final Type type;
051:
052:            protected HashMap keyJavaType = new HashMap();
053:
054:            /**
055:             * creates a new LDT complete with the target sort of the language
056:             * datatype, the java datatype, and sorts
057:             * @param name the name of the language datatype model and the 
058:             * corresponding sort
059:             * @param sorts  namespace which contains the target sort
060:             * @param type the type used in the java program esp. in the AST
061:             * of the java program
062:             */
063:            public LDT(Name name, Namespace sorts, Type type) {
064:                super (name);
065:                this .sort = (Sort) sorts.lookup(name);
066:                this .type = type;
067:                assert sort != null;
068:                addSort(sort);
069:                keyJavaType.put(type, new KeYJavaType(type, sort));
070:            }
071:
072:            /**
073:             * adds a function to the LDT 
074:             * @return the added function (for convenience reasons)
075:             */
076:            public Function addFunction(Function f) {
077:                functions.add(f);
078:                return f;
079:            }
080:
081:            /**
082:             * looks up a function in the namespace and add it to the LDT 
083:             * @param functions a Namespace with symbols
084:             * @param String the String with the name of the function to look up
085:             * @return the added function (for convenience reasons)
086:             */
087:            public Function addFunction(Namespace funcNS, String funcName) {
088:                final Function f = (Function) funcNS.lookup(new Name(funcName));
089:                functions.add(f);
090:                if (f == null) {
091:                    System.out.println("IntegerLDT: Function " + funcName
092:                            + " not found");
093:                }
094:                return f;
095:            }
096:
097:            /** returns the sort the java type is mapped to
098:             * @return  the sort the java type is mapped to
099:             */
100:            public Sort targetSort() {
101:                return sort;
102:            }
103:
104:            /** returns the java type the model describes
105:             * @return the java type the model describes
106:             */
107:            public Type javaType() {
108:                return type;
109:            }
110:
111:            /** returns the KeYJavaType for the the given type 
112:             * @param t the Type for which the coressponding KeYJavaType has to be
113:             * returned 
114:             * @return the KeYJavaType the the given type t
115:             */
116:            public KeYJavaType getKeYJavaType(Type t) {
117:                return (KeYJavaType) keyJavaType.get(t);
118:            }
119:
120:            /** returns the basic functions of the model
121:             * @return the basic functions of the model
122:             */
123:            public Namespace functions() {
124:                return functions;
125:            }
126:
127:            /** returns the model specific rules 
128:             * @return the model specific rules 
129:             */
130:            public SetOfTaclet rules() {
131:                return rules;
132:            }
133:
134:            /** toString */
135:            public String toString() {
136:                return "LDT " + name() + " (" + targetSort() + "<->"
137:                        + javaType() + ")";
138:            }
139:
140:            /** returns the file ID for the parser */
141:            public String getFile() {
142:                return name().toString();
143:            }
144:
145:            /** returns true if the LDT offers an operation for the given java
146:             * operator and the logic subterms 
147:             * @param op the de.uka.ilkd.key.java.expression.Operator to
148:             * translate
149:             * @param subs the logic subterms of the java operator
150:             * @param services the Services
151:             * @param ec the ExecutionContext in which the expression is evaluated
152:             * @return  true if the LDT offers an operation for the given java
153:             * operator and the subterms 
154:             */
155:            public abstract boolean isResponsible(
156:                    de.uka.ilkd.key.java.expression.Operator op, Term[] subs,
157:                    Services services, ExecutionContext ec);
158:
159:            /** returns true if the LDT offers an operation for the given
160:             * binary java operator and the logic subterms 
161:             * @param op the de.uka.ilkd.key.java.expression.Operator to
162:             * translate
163:             * @param left the left subterm of the java operator
164:             * @param right the right subterm of the java operator
165:             * @param services the Services
166:             * @param ec the ExecutionContext in which the expression is evaluated
167:             * @return  true if the LDT offers an operation for the given java
168:             * operator and the subterms 
169:             */
170:            public abstract boolean isResponsible(
171:                    de.uka.ilkd.key.java.expression.Operator op, Term left,
172:                    Term right, Services services, ExecutionContext ec);
173:
174:            /** returns true if the LDT offers an operation for the given
175:             * unary java operator and the logic subterms 
176:             * @param op the de.uka.ilkd.key.java.expression.Operator to
177:             * translate
178:             * @param sub the logic subterms of the java operator
179:             * @param services the Services 
180:             * @param ec the ExecutionContext in which the expression is evaluated    * @param services TODO
181:             * @return  true if the LDT offers an operation for the given java
182:             * operator and the subterm
183:             */
184:            public abstract boolean isResponsible(
185:                    de.uka.ilkd.key.java.expression.Operator op, Term sub,
186:                    Services services, ExecutionContext ec);
187:
188:            /** translates a given literal to its logic counterpart 
189:             * @param lit the Literal to be translated
190:             * @return the Term that represents the given literal in its logic
191:             * form
192:             */
193:            public abstract Term translateLiteral(Literal lit);
194:
195:            /** returns the function symbol for the given operation 
196:             * @return  the function symbol for the given operation 
197:             */
198:            public abstract Function getFunctionFor(
199:                    de.uka.ilkd.key.java.expression.Operator op, Services serv,
200:                    ExecutionContext ec);
201:
202:            public boolean containsFunction(Function op) {
203:                Named n = functions.lookup(op.name());
204:                return (n == op);
205:            }
206:
207:            public abstract boolean hasLiteralFunction(Function f);
208:
209:            public abstract Expression translateTerm(Term t, ExtList children);
210:
211:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.