001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2004-2006, GeoTools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: */
016: package org.geotools.xml.schema.impl;
017:
018: import java.net.URI;
019:
020: import org.geotools.xml.schema.Element;
021: import org.geotools.xml.schema.ElementGrouping;
022: import org.geotools.xml.schema.Schema;
023: import org.geotools.xml.schema.Type;
024:
025: /**
026: * Provides ...TODO summary sentence
027: * <p>
028: * TODO Description
029: * </p><p>
030: * Responsibilities:
031: * <ul>
032: * <li>
033: * <li>
034: * </ul>
035: * </p><p>
036: * Example Use:<pre><code>
037: * ElementGT x = new ElementGT( ... );
038: * TODO code example
039: * </code></pre>
040: * </p>
041: * @author dzwiers
042: * @since 0.3
043: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/xml/src/main/java/org/geotools/xml/schema/impl/ElementGT.java $
044: */
045: public class ElementGT implements Element {
046:
047: private Type type = null;
048: private boolean _abstract, nillable;
049: private Element sub = null;
050: private URI ns = null;
051: private String name = null, id = null;
052: private int min = 1, max = 1;
053:
054: /**
055: * Construct <code>ElementGT</code>.
056: *
057: * @param id
058: * @param name
059: * @param namespace
060: * @param type
061: * @param min
062: * @param max
063: * @param nillable
064: * @param substitutionGroup
065: * @param _abstract
066: */
067: public ElementGT(String id, String name, URI namespace, Type type,
068: int min, int max, boolean nillable,
069: Element substitutionGroup, boolean _abstract) {
070: this .type = type;
071: this ._abstract = _abstract;
072: this .nillable = nillable;
073: this .sub = substitutionGroup;
074: this .ns = namespace;
075: this .name = name;
076: this .id = id;
077: this .min = min;
078: this .max = max;
079: }
080:
081: /**
082: * TODO summary sentence for isAbstract ...
083: *
084: * @see org.geotools.xml.schema.Element#isAbstract()
085: */
086: public boolean isAbstract() {
087: return _abstract;
088: }
089:
090: /**
091: * TODO summary sentence for getBlock ...
092: *
093: * @see org.geotools.xml.schema.Element#getBlock()
094: */
095: public int getBlock() {
096: return Schema.NONE;
097: }
098:
099: /**
100: * TODO summary sentence for getDefault ...
101: *
102: * @see org.geotools.xml.schema.Element#getDefault()
103: */
104: public String getDefault() {
105: return null;
106: }
107:
108: /**
109: * TODO summary sentence for getFinal ...
110: *
111: * @see org.geotools.xml.schema.Element#getFinal()
112: */
113: public int getFinal() {
114: return Schema.NONE;
115: }
116:
117: /**
118: * TODO summary sentence for getFixed ...
119: *
120: * @see org.geotools.xml.schema.Element#getFixed()
121: */
122: public String getFixed() {
123: return null;
124: }
125:
126: /**
127: * TODO summary sentence for isForm ...
128: *
129: * @see org.geotools.xml.schema.Element#isForm()
130: */
131: public boolean isForm() {
132: return false;
133: }
134:
135: /**
136: * TODO summary sentence for getId ...
137: *
138: * @see org.geotools.xml.schema.Element#getId()
139: */
140: public String getId() {
141: return id;
142: }
143:
144: /**
145: * TODO summary sentence for getMaxOccurs ...
146: *
147: * @see org.geotools.xml.schema.ElementGrouping#getMaxOccurs()
148: */
149: public int getMaxOccurs() {
150: return max;
151: }
152:
153: /**
154: * TODO summary sentence for getMinOccurs ...
155: *
156: * @see org.geotools.xml.schema.ElementGrouping#getMinOccurs()
157: */
158: public int getMinOccurs() {
159: return min;
160: }
161:
162: /**
163: * TODO summary sentence for getName ...
164: *
165: * @see org.geotools.xml.schema.Element#getName()
166: */
167: public String getName() {
168: return name;
169: }
170:
171: /**
172: * TODO summary sentence for getNamespace ...
173: *
174: * @see org.geotools.xml.schema.Element#getNamespace()
175: */
176: public URI getNamespace() {
177: return ns;
178: }
179:
180: /**
181: * TODO summary sentence for isNillable ...
182: *
183: * @see org.geotools.xml.schema.Element#isNillable()
184: */
185: public boolean isNillable() {
186: return nillable;
187: }
188:
189: /**
190: * TODO summary sentence for getSubstitutionGroup ...
191: *
192: * @see org.geotools.xml.schema.Element#getSubstitutionGroup()
193: */
194: public Element getSubstitutionGroup() {
195: return sub;
196: }
197:
198: /**
199: * TODO summary sentence for getType ...
200: *
201: * @see org.geotools.xml.schema.Element#getType()
202: */
203: public Type getType() {
204: return type;
205: }
206:
207: /**
208: * TODO summary sentence for getGrouping ...
209: *
210: * @see org.geotools.xml.schema.ElementGrouping#getGrouping()
211: */
212: public int getGrouping() {
213: return ElementGrouping.ELEMENT;
214: }
215:
216: /**
217: * TODO summary sentence for findChildElement ...
218: *
219: * @see org.geotools.xml.schema.ElementGrouping#findChildElement(java.lang.String)
220: * @param name1
221: */
222: public Element findChildElement(String name1) {
223: return (getName() != null && getName().equals(name1)) ? this
224: : null;
225: }
226:
227: public Element findChildElement(String localName, URI namespaceURI) {
228: return (getName() != null && getName().equals(localName) && getNamespace()
229: .equals(namespaceURI)) ? this : null;
230: }
231: }
|