Source Code Cross Referenced for ComplexTypeImpl.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.XSAttGroupDecl;
023:        import com.sun.xml.xsom.XSAttributeDecl;
024:        import com.sun.xml.xsom.XSAttributeUse;
025:        import com.sun.xml.xsom.XSComplexType;
026:        import com.sun.xml.xsom.XSContentType;
027:        import com.sun.xml.xsom.XSElementDecl;
028:        import com.sun.xml.xsom.XSSimpleType;
029:        import com.sun.xml.xsom.XSType;
030:        import com.sun.xml.xsom.XSWildcard;
031:        import com.sun.xml.xsom.impl.parser.DelayedRef;
032:        import com.sun.xml.xsom.impl.parser.SchemaDocumentImpl;
033:        import com.sun.xml.xsom.impl.scd.Iterators;
034:        import com.sun.xml.xsom.visitor.XSFunction;
035:        import com.sun.xml.xsom.visitor.XSVisitor;
036:        import org.xml.sax.Locator;
037:
038:        import java.util.Iterator;
039:
040:        public class ComplexTypeImpl extends AttributesHolder implements 
041:                XSComplexType, Ref.ComplexType {
042:            public ComplexTypeImpl(SchemaDocumentImpl _parent,
043:                    AnnotationImpl _annon, Locator _loc,
044:                    ForeignAttributesImpl _fa, String _name,
045:                    boolean _anonymous,
046:
047:                    boolean _abstract, int _derivationMethod, Ref.Type _base,
048:                    int _final, int _block, boolean _mixed) {
049:
050:                super (_parent, _annon, _loc, _fa, _name, _anonymous);
051:
052:                if (_base == null)
053:                    throw new IllegalArgumentException();
054:
055:                this ._abstract = _abstract;
056:                this .derivationMethod = _derivationMethod;
057:                this .baseType = _base;
058:                this .finalValue = _final;
059:                this .blockValue = _block;
060:                this .mixed = _mixed;
061:            }
062:
063:            public XSComplexType asComplexType() {
064:                return this ;
065:            }
066:
067:            public boolean isDerivedFrom(XSType t) {
068:                XSType x = this ;
069:                while (true) {
070:                    if (t == x)
071:                        return true;
072:                    XSType s = x.getBaseType();
073:                    if (s == x)
074:                        return false;
075:                    x = s;
076:                }
077:            }
078:
079:            public XSSimpleType asSimpleType() {
080:                return null;
081:            }
082:
083:            public final boolean isSimpleType() {
084:                return false;
085:            }
086:
087:            public final boolean isComplexType() {
088:                return true;
089:            }
090:
091:            private int derivationMethod;
092:
093:            public int getDerivationMethod() {
094:                return derivationMethod;
095:            }
096:
097:            private Ref.Type baseType;
098:
099:            public XSType getBaseType() {
100:                return baseType.getType();
101:            }
102:
103:            /**
104:             * Called when this complex type redefines the specified complex type.
105:             */
106:            public void redefine(ComplexTypeImpl ct) {
107:                if (baseType instanceof  DelayedRef)
108:                    ((DelayedRef) baseType).redefine(ct);
109:                else
110:                    this .baseType = ct;
111:                ct.redefinedBy = this ;
112:                redefiningCount = (short) (ct.redefiningCount + 1);
113:            }
114:
115:            /**
116:             * Number of times this component redefines other components.
117:             */
118:            private short redefiningCount = 0;
119:
120:            private ComplexTypeImpl redefinedBy = null;
121:
122:            public XSComplexType getRedefinedBy() {
123:                return redefinedBy;
124:            }
125:
126:            public int getRedefinedCount() {
127:                int i = 0;
128:                for (ComplexTypeImpl ct = this .redefinedBy; ct != null; ct = ct.redefinedBy)
129:                    i++;
130:                return i;
131:            }
132:
133:            private XSElementDecl scope;
134:
135:            public XSElementDecl getScope() {
136:                return scope;
137:            }
138:
139:            public void setScope(XSElementDecl _scope) {
140:                this .scope = _scope;
141:            }
142:
143:            private final boolean _abstract;
144:
145:            public boolean isAbstract() {
146:                return _abstract;
147:            }
148:
149:            private WildcardImpl localAttWildcard;
150:
151:            /**
152:             * Set the local attribute wildcard.
153:             */
154:            public void setWildcard(WildcardImpl wc) {
155:                this .localAttWildcard = wc;
156:            }
157:
158:            public XSWildcard getAttributeWildcard() {
159:                WildcardImpl complete = localAttWildcard;
160:
161:                Iterator itr = iterateAttGroups();
162:                while (itr.hasNext()) {
163:                    WildcardImpl w = (WildcardImpl) ((XSAttGroupDecl) itr
164:                            .next()).getAttributeWildcard();
165:
166:                    if (w == null)
167:                        continue;
168:
169:                    if (complete == null)
170:                        complete = w;
171:                    else
172:                        // TODO: the spec says it's intersection,
173:                        // but I think it has to be union.
174:                        complete = complete.union(ownerDocument, w);
175:                }
176:
177:                if (getDerivationMethod() == RESTRICTION)
178:                    return complete;
179:
180:                WildcardImpl base = null;
181:                XSType baseType = getBaseType();
182:                if (baseType.asComplexType() != null)
183:                    base = (WildcardImpl) baseType.asComplexType()
184:                            .getAttributeWildcard();
185:
186:                if (complete == null)
187:                    return base;
188:                if (base == null)
189:                    return complete;
190:
191:                return complete.union(ownerDocument, base);
192:            }
193:
194:            private final int finalValue;
195:
196:            public boolean isFinal(int derivationMethod) {
197:                return (finalValue & derivationMethod) != 0;
198:            }
199:
200:            private final int blockValue;
201:
202:            public boolean isSubstitutionProhibited(int method) {
203:                return (blockValue & method) != 0;
204:            }
205:
206:            private Ref.ContentType contentType;
207:
208:            public void setContentType(Ref.ContentType v) {
209:                contentType = v;
210:            }
211:
212:            public XSContentType getContentType() {
213:                return contentType.getContentType();
214:            }
215:
216:            private XSContentType explicitContent;
217:
218:            public void setExplicitContent(XSContentType v) {
219:                this .explicitContent = v;
220:            }
221:
222:            public XSContentType getExplicitContent() {
223:                return explicitContent;
224:            }
225:
226:            private final boolean mixed;
227:
228:            public boolean isMixed() {
229:                return mixed;
230:            }
231:
232:            public XSAttributeUse getAttributeUse(String nsURI, String localName) {
233:                UName name = new UName(nsURI, localName);
234:
235:                if (prohibitedAtts.contains(name))
236:                    return null;
237:
238:                XSAttributeUse o = attributes.get(name);
239:
240:                if (o == null) {
241:                    Iterator itr = iterateAttGroups();
242:                    while (itr.hasNext() && o == null)
243:                        o = ((XSAttGroupDecl) itr.next()).getAttributeUse(
244:                                nsURI, localName);
245:                }
246:
247:                if (o == null) {
248:                    XSType base = getBaseType();
249:                    if (base.asComplexType() != null)
250:                        o = base.asComplexType().getAttributeUse(nsURI,
251:                                localName);
252:                }
253:
254:                return o;
255:            }
256:
257:            public Iterator<XSAttributeUse> iterateAttributeUses() {
258:
259:                XSComplexType baseType = getBaseType().asComplexType();
260:
261:                if (baseType == null)
262:                    return super .iterateAttributeUses();
263:
264:                return new Iterators.Union<XSAttributeUse>(
265:                        new Iterators.Filter<XSAttributeUse>(baseType
266:                                .iterateAttributeUses()) {
267:                            protected boolean matches(XSAttributeUse value) {
268:                                XSAttributeDecl u = value.getDecl();
269:                                UName n = new UName(u.getTargetNamespace(), u
270:                                        .getName());
271:                                return !prohibitedAtts.contains(n);
272:                            }
273:                        }, super .iterateAttributeUses());
274:            }
275:
276:            public XSType[] listSubstitutables() {
277:                return Util.listSubstitutables(this );
278:            }
279:
280:            public void visit(XSVisitor visitor) {
281:                visitor.complexType(this );
282:            }
283:
284:            public <T> T apply(XSFunction<T> function) {
285:                return function.complexType(this );
286:            }
287:
288:            // Ref.ComplexType implementation
289:            public XSComplexType getType() {
290:                return this;
291:            }
292:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.