Source Code Cross Referenced for TypeConstructorLeqCst.java in  » Scripting » Nice » mlsub » typing » 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 » Scripting » Nice » mlsub.typing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        /**************************************************************************/
02:        /*                           B O S S A                                    */
03:        /*        A simple imperative object-oriented research language           */
04:        /*                   (c)  Daniel Bonniot 1999                             */
05:        /*                                                                        */
06:        /*  This program is free software; you can redistribute it and/or modify  */
07:        /*  it under the terms of the GNU General Public License as published by  */
08:        /*  the Free Software Foundation; either version 2 of the License, or     */
09:        /*  (at your option) any later version.                                   */
10:        /*                                                                        */
11:        /**************************************************************************/package mlsub.typing;
12:
13:        /**
14:         * Constraint on type constructors.
15:         * 
16:         * @author Daniel Bonniot
17:         */
18:
19:        public final class TypeConstructorLeqCst extends AtomicConstraint {
20:            public TypeConstructorLeqCst(TypeConstructor t1, TypeConstructor t2) {
21:                this .t1 = t1;
22:                this .t2 = t2;
23:
24:                identifyVariances(t1, t2);
25:            }
26:
27:            /**
28:             * Assert that t1 and t2 have the same variance.
29:             *
30:             * This is not necessary, as it would be discovered later 
31:             * in the constraint solver.
32:             * But it seems good to discover it sooner, 
33:             * for efficiency reasons
34:             * (and for error reporting if we added a check).
35:             */
36:            private static void identifyVariances(TypeConstructor t1,
37:                    TypeConstructor t2) {
38:                if (t1.variance == null && t2.variance != null)
39:                    t1.setVariance(t2.variance);
40:                else if (t2.variance == null && t1.variance != null)
41:                    t2.setVariance(t1.variance);
42:            }
43:
44:            /**
45:             * Perform type symbol substitution inside the constraint.
46:             *
47:             * Does not need to create a new object, but must not
48:             * imperatively modify the constraint.
49:             *
50:             * @param map a map from TypeSymbols to TypeSymbols
51:             * @return an atomic constraint with substitution performed
52:             */
53:            AtomicConstraint substitute(java.util.Map map) {
54:                Object tt1, tt2;
55:                tt1 = map.get(t1);
56:                tt2 = map.get(t2);
57:
58:                if (tt1 == null && tt2 == null)
59:                    return this ;
60:
61:                if (tt1 == null)
62:                    tt1 = t1;
63:                else if (tt2 == null)
64:                    tt2 = t2;
65:
66:                return new TypeConstructorLeqCst((TypeConstructor) tt1,
67:                        (TypeConstructor) tt2);
68:            }
69:
70:            public void enter() throws TypingEx {
71:                Typing.leq(t1, t2);
72:            }
73:
74:            public String toString() {
75:                return t1 + " < " + t2;
76:            }
77:
78:            private TypeConstructor t1;
79:            private TypeConstructor t2;
80:
81:            public TypeConstructor t1() {
82:                return t1;
83:            }
84:
85:            public TypeConstructor t2() {
86:                return t2;
87:            }
88:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.