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;
017:
018: import java.net.URI;
019:
020: /**
021: * <p>
022: * This represents an abstract collection of xml element definitions within a
023: * Schema.
024: * </p>
025: *
026: * <p>
027: * To avoid multiple type checks, a group mask was include, as described below.
028: * </p>
029: *
030: * @author dzwiers www.refractions.net
031: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/xml/src/main/java/org/geotools/xml/schema/ElementGrouping.java $
032: */
033: public interface ElementGrouping {
034: /**
035: * ElementGrouping mask to determine the type of ElementGrouping
036: * represented. This is intended to reduce the use of the instanceof
037: * operand, increasing performance.
038: */
039: public static final int ELEMENT = 1;
040:
041: /**
042: * ElementGrouping mask to determine the type of ElementGrouping
043: * represented. This is intended to reduce the use of the instanceof
044: * operand, increasing performance.
045: */
046: public static final int GROUP = 2;
047:
048: /**
049: * ElementGrouping mask to determine the type of ElementGrouping
050: * represented. This is intended to reduce the use of the instanceof
051: * operand, increasing performance.
052: */
053: public static final int ANY = 4;
054:
055: /**
056: * ElementGrouping mask to determine the type of ElementGrouping
057: * represented. This is intended to reduce the use of the instanceof
058: * operand, increasing performance.
059: */
060: public static final int SEQUENCE = 8;
061:
062: /**
063: * ElementGrouping mask to determine the type of ElementGrouping
064: * represented. This is intended to reduce the use of the instanceof
065: * operand, increasing performance.
066: */
067: public static final int CHOICE = 16;
068:
069: /**
070: * ElementGrouping mask to determine the type of ElementGrouping
071: * represented. This is intended to reduce the use of the instanceof
072: * operand, increasing performance.
073: */
074: public static final int ALL = 32;
075:
076: public static final int UNBOUNDED = Integer.MAX_VALUE;
077:
078: /**
079: * <p>
080: * Returns the mask informing the caller as to the type of object they are
081: * dealing with.
082: * </p>
083: *
084: */
085: public int getGrouping();
086:
087: /**
088: * <p>
089: * Convinience method which will search for the specified element within
090: * it's children. This is typically implemented recursively, and as such
091: * may be expensive to execute (so don't call me too much if you want to
092: * be fast).
093: * </p>
094: *
095: * @param name The Element LocalName (namespace and prefix should not be
096: * included)
097: *
098: * @return Element or null if not found.
099: */
100: public Element findChildElement(String name);
101:
102: /**
103: * <p>
104: * returns the max number of allowable occurences within the xml schema for
105: * this construct.
106: * </p>
107: *
108: */
109: public int getMaxOccurs();
110:
111: /**
112: * <p>
113: * returns the min number of allowable occurences within the xml schema for
114: * this construct.
115: * </p>
116: *
117: */
118: public int getMinOccurs();
119:
120: public Element findChildElement(String localName, URI namespaceURI);
121: }
|