Source Code Cross Referenced for Util.java in  » 6.0-JDK-Modules » jaxb-xjc » com » sun » xml » xsom » impl » 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 » 6.0 JDK Modules » jaxb xjc » com.sun.xml.xsom.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the terms
003:         * of the Common Development and Distribution License
004:         * (the "License").  You may not use this file except
005:         * in compliance with the License.
006:         * 
007:         * You can obtain a copy of the license at
008:         * https://jwsdp.dev.java.net/CDDLv1.0.html
009:         * See the License for the specific language governing
010:         * permissions and limitations under the License.
011:         * 
012:         * When distributing Covered Code, include this CDDL
013:         * HEADER in each file and include the License file at
014:         * https://jwsdp.dev.java.net/CDDLv1.0.html  If applicable,
015:         * add the following below this CDDL HEADER, with the
016:         * fields enclosed by brackets "[]" replaced with your
017:         * own identifying information: Portions Copyright [yyyy]
018:         * [name of copyright owner]
019:         */
020:        package com.sun.xml.xsom.impl;
021:
022:        import com.sun.xml.xsom.XSComplexType;
023:        import com.sun.xml.xsom.XSType;
024:
025:        import java.util.ArrayList;
026:        import java.util.HashSet;
027:        import java.util.Iterator;
028:        import java.util.Set;
029:
030:        /**
031:         * 
032:         * 
033:         * @author
034:         *     Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
035:         */
036:        class Util {
037:            private static XSType[] listDirectSubstitutables(XSType _this ) {
038:                ArrayList r = new ArrayList();
039:
040:                // TODO: handle @block
041:                Iterator itr = ((SchemaImpl) _this .getOwnerSchema()).parent
042:                        .iterateTypes();
043:                while (itr.hasNext()) {
044:                    XSType t = (XSType) itr.next();
045:                    if (t.getBaseType() == _this )
046:                        r.add(t);
047:                }
048:                return (XSType[]) r.toArray(new XSType[r.size()]);
049:            }
050:
051:            public static XSType[] listSubstitutables(XSType _this ) {
052:                Set substitables = new HashSet();
053:                buildSubstitutables(_this , substitables);
054:                return (XSType[]) substitables.toArray(new XSType[substitables
055:                        .size()]);
056:            }
057:
058:            public static void buildSubstitutables(XSType _this ,
059:                    Set substitutables) {
060:                if (_this .isLocal())
061:                    return;
062:                buildSubstitutables(_this , _this , substitutables);
063:            }
064:
065:            private static void buildSubstitutables(XSType head, XSType _this ,
066:                    Set substitutables) {
067:                if (!isSubstitutable(head, _this ))
068:                    return; // no derived type of _this can substitute head.
069:
070:                if (substitutables.add(_this )) {
071:                    XSType[] child = listDirectSubstitutables(_this );
072:                    for (int i = 0; i < child.length; i++)
073:                        buildSubstitutables(head, child[i], substitutables);
074:                }
075:            }
076:
077:            /**
078:             * Implements
079:             * <code>Validation Rule: Schema-Validity Assessment (Element) 1.2.1.2.4</code> 
080:             */
081:            private static boolean isSubstitutable(XSType _base, XSType derived) {
082:                // too ugly to the point that it's almost unbearable.
083:                // I mean, it's not even transitive. Thus we end up calling this method
084:                // for each candidate
085:                if (_base.isComplexType()) {
086:                    XSComplexType base = _base.asComplexType();
087:
088:                    for (; base != derived; derived = derived.getBaseType()) {
089:                        if (base.isSubstitutionProhibited(derived
090:                                .getDerivationMethod()))
091:                            return false; // Type Derivation OK (Complex)-1
092:                    }
093:                    return true;
094:                } else {
095:                    // simple type don't have any @block
096:                    return true;
097:                }
098:            }
099:
100:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.