Source Code Cross Referenced for ElementDeclaration.java in  » GIS » deegree » org » deegree » framework » xml » schema » 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 » GIS » deegree » org.deegree.framework.xml.schema 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/framework/xml/schema/ElementDeclaration.java $
002:        /*----------------    FILE HEADER  ------------------------------------------
003:
004:         This file is part of deegree.
005:         Copyright (C) 2001-2008 by:
006:         EXSE, Department of Geography, University of Bonn
007:         http://www.giub.uni-bonn.de/deegree/
008:         lat/lon GmbH
009:         http://www.lat-lon.de
010:
011:         This library is free software; you can redistribute it and/or
012:         modify it under the terms of the GNU Lesser General Public
013:         License as published by the Free Software Foundation; either
014:         version 2.1 of the License, or (at your option) any later version.
015:
016:         This library is distributed in the hope that it will be useful,
017:         but WITHOUT ANY WARRANTY; without even the implied warranty of
018:         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
019:         Lesser General Public License for more details.
020:
021:         You should have received a copy of the GNU Lesser General Public
022:         License along with this library; if not, write to the Free Software
023:         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
024:
025:         Contact:
026:
027:         Andreas Poth
028:         lat/lon GmbH
029:         Aennchenstraße 19
030:         53177 Bonn
031:         Germany
032:         E-Mail: poth@lat-lon.de
033:
034:         Prof. Dr. Klaus Greve
035:         Department of Geography
036:         University of Bonn
037:         Meckenheimer Allee 166
038:         53115 Bonn
039:         Germany
040:         E-Mail: greve@giub.uni-bonn.de
041:        
042:         ---------------------------------------------------------------------------*/
043:        package org.deegree.framework.xml.schema;
044:
045:        import org.deegree.datatypes.QualifiedName;
046:
047:        /**
048:         * Represents an XML element declaration in an {@link XMLSchema}.
049:         * 
050:         * @author <a href="mailto:schneider@lat-lon.de">Markus Schneider </a>
051:         * @author last edited by: $Author: apoth $
052:         * 
053:         * @version $Revision: 9339 $, $Date: 2007-12-27 04:31:52 -0800 (Thu, 27 Dec 2007) $
054:         */
055:        public class ElementDeclaration {
056:
057:            private QualifiedName name;
058:
059:            private boolean isAbstract;
060:
061:            private TypeReference type;
062:
063:            private int minOccurs;
064:
065:            private int maxOccurs;
066:
067:            private ElementReference substitutionGroup;
068:
069:            /**
070:             * Creates a new <code>ElementDeclaration</code> instance from the given parameters.
071:             * 
072:             * @param name
073:             * @param isAbstract
074:             * @param type
075:             * @param minOccurs
076:             * @param maxOccurs
077:             * @param substitutionGroup
078:             */
079:            public ElementDeclaration(QualifiedName name, boolean isAbstract,
080:                    TypeReference type, int minOccurs, int maxOccurs,
081:                    QualifiedName substitutionGroup) {
082:                this .name = name;
083:                this .isAbstract = isAbstract;
084:                this .type = type;
085:                this .minOccurs = minOccurs;
086:                this .maxOccurs = maxOccurs;
087:                if (substitutionGroup != null) {
088:                    this .substitutionGroup = new ElementReference(
089:                            substitutionGroup);
090:                }
091:            }
092:
093:            /**
094:             * Returns the qualified name of the declared XML element.
095:             * 
096:             * @return the qualified name of the declared XML element
097:             */
098:            public QualifiedName getName() {
099:                return this .name;
100:            }
101:
102:            /**
103:             * Returns whether the element is declared abstract.
104:             * 
105:             * @return true, if the element is abstract, false otherwise
106:             */
107:            public boolean isAbstract() {
108:                return this .isAbstract;
109:            }
110:
111:            /**
112:             * Returns a {@link TypeReference} that describes the content of the element.
113:             * 
114:             * @return a TypeReference that describes the content of the element
115:             */
116:            public TypeReference getType() {
117:                return this .type;
118:            }
119:
120:            /**
121:             * Returns the minimum number of occurences of the element.
122:             * 
123:             * @return the minimum number of occurences of the element, -1 if it is unconstrained
124:             */
125:            public int getMinOccurs() {
126:                return this .minOccurs;
127:            }
128:
129:            /**
130:             * Returns the maximum number of occurences of the element.
131:             * 
132:             * @return the maximum number of occurences of the element, -1 if it is unconstrained
133:             */
134:            public int getMaxOccurs() {
135:                return this .maxOccurs;
136:            }
137:
138:            /**
139:             * Returns an {@link ElementReference} which the element may be substituted for. 
140:             * 
141:             * @return an ElementReference which the element may be substituted for
142:             */
143:            public ElementReference getSubstitutionGroup() {
144:                return this .substitutionGroup;
145:            }
146:
147:            /**
148:             * Returns whether this element is substitutable for the given element name.
149:             * <p>
150:             * This is true if the substitutionGroup equals the given element name, or if an element that
151:             * this element is substitutable for may be substituted for the given element name.
152:             * 
153:             * @param substitutionName
154:             * @return true, if this element declaration is a valid substiution for elements with the
155:             *             given name
156:             */
157:            public boolean isSubstitutionFor(QualifiedName substitutionName) {
158:                if (this .name.equals(substitutionName)) {
159:                    return true;
160:                }
161:                if (this .substitutionGroup == null) {
162:                    return false;
163:                }
164:                if (this .substitutionGroup.getElementDeclaration() == null) {
165:                    return this .substitutionGroup.getName().equals(
166:                            substitutionName);
167:                }
168:                return this .substitutionGroup.getElementDeclaration()
169:                        .isSubstitutionFor(substitutionName);
170:            }
171:
172:            /**
173:             * Returns a string representation of the object (indented for better readablity,
174:             * as this is part of a hierarchical structure).
175:             * 
176:             * @param indent
177:             *             current indentation (as a whitespace string)
178:             * @return an indented string representation of the object
179:             */
180:            public String toString(String indent) {
181:                StringBuffer sb = new StringBuffer();
182:                sb.append(indent);
183:                sb.append("- element");
184:                if (this .name != null) {
185:                    sb.append(" name=\"");
186:                    sb.append(this .name.getLocalName());
187:                    sb.append("\"");
188:                }
189:                if (!this .type.isAnonymous()) {
190:                    sb.append(" type=\"");
191:                    sb.append(this .type.getName());
192:                    sb.append("\"");
193:                } else {
194:                    sb.append(" anonymous type");
195:                }
196:                if (this .substitutionGroup != null) {
197:                    sb.append(" substitutionGroup=\"");
198:                    sb.append(this .substitutionGroup.getName());
199:                    sb.append("\"");
200:                }
201:                sb.append("\n");
202:                if (this .type.isAnonymous()) {
203:                    sb.append(this .type.getTypeDeclaration().toString(
204:                            indent + "  "));
205:                }
206:                return sb.toString();
207:            }
208:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.