View Javadoc
1   /**
2    * Redistribution and use of this software and associated documentation ("Software"), with or
3    * without modification, are permitted provided that the following conditions are met:
4    *
5    * 1. Redistributions of source code must retain copyright statements and notices. Redistributions
6    * must also contain a copy of this document.
7    *
8    * 2. Redistributions in binary form must reproduce the above copyright notice, this list of
9    * conditions and the following disclaimer in the documentation and/or other materials provided with
10   * the distribution.
11   *
12   * 3. The name "Exolab" must not be used to endorse or promote products derived from this Software
13   * without prior written permission of Intalio, Inc. For written permission, please contact
14   * info@exolab.org.
15   *
16   * 4. Products derived from this Software may not be called "Exolab" nor may "Exolab" appear in
17   * their names without prior written permission of Intalio, Inc. Exolab is a registered trademark of
18   * Intalio, Inc.
19   *
20   * 5. Due credit should be given to the Exolab Project (http://www.exolab.org/).
21   *
22   * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR
23   * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
24   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTALIO, INC. OR ITS
25   * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27   * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
29   * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30   *
31   * Copyright 1999, 2000 (C) Intalio, Inc. All Rights Reserved.
32   *
33   * $Id$
34   */
35  
36  package org.exolab.castor.xml.schema;
37  
38  import java.util.Enumeration;
39  
40  /**
41   * An XML Schema ModelGroup.
42   * 
43   * @author <a href="mailto:kvisco@intalio.com">Keith Visco</a>
44   * @version $Revision$ $Date: 2006-04-14 04:14:43 -0600 (Fri, 14 Apr 2006) $
45   **/
46  public interface ContentModelGroup {
47  
48    /**
49     * Adds the given ElementDecl to this ContentModelGroup.
50     * 
51     * @param elementDecl the ElementDecl to add
52     * @exception SchemaException when an ElementDecl already exists with the same name as the given
53     *            ElementDecl
54     **/
55    void addElementDecl(ElementDecl elementDecl) throws SchemaException;
56  
57    /**
58     * Removes the given ElementDecl from this ContentModelGroup.
59     * 
60     * @param elementDecl the ElementDecl to remove.
61     * @return true if the element has been successfully removed, false otherwise.
62     */
63    boolean removeElementDecl(ElementDecl elementDecl);
64  
65    /**
66     * Adds the given {@link Group} to this {@link ContentModelGroup}.
67     * 
68     * @param group the Group to add
69     * @exception SchemaException when a group with the same name as the specified group already
70     *            exists in the current scope
71     **/
72    void addGroup(Group group) throws SchemaException;
73  
74    /**
75     * Removes the given {@link Group} from this {@link ContentModelGroup}.
76     * 
77     * @param group the Group to remove.
78     * @return true if the group has been successfully removed, false otherwise.
79     */
80    boolean removeGroup(Group group);
81  
82    /**
83     * Adds the given {@link ModelGroup} definition to this {@link ContentModelGroup}.
84     * 
85     * @param group the ModelGroup to add
86     * @exception SchemaException when a group with the same name as the specified group already
87     *            exists in the current scope
88     **/
89    void addGroup(ModelGroup group) throws SchemaException;
90  
91    /**
92     * Removes the given {@link ModelGroup} definition from this {@link ContentModelGroup}.
93     * 
94     * @param group the {@link ModelGroup} definition to remove.
95     * @return true if the group has been successfully removed, false otherwise.
96     */
97    boolean removeGroup(ModelGroup group);
98  
99    /**
100    * Adds the given {@link Wildcard} to this {@link ContentModelGroup}.
101    * 
102    * @param wilcard the {@link Wildcard} to add
103    * @exception SchemaException when the {@link Wildcard} is &lt;anyAttribute> and not &lt;any>
104    */
105   void addWildcard(Wildcard wilcard) throws SchemaException;
106 
107   /**
108    * Removes the given {@link Wildcard} from this {@link ContentModelGroup}.
109    * 
110    * @param wildcard the {@link Wildcard} to remove.
111    * @return true if the given {@link Wildcard} has been successfully removed, false otherwise.
112    */
113   boolean removeWildcard(Wildcard wildcard);
114 
115   /**
116    * Returns an enumeration of all the {@link Particle}s contained within this
117    * {@link ContentModelGroup}.
118    *
119    * @return an enumeration of all the {@link Particle}s contained within this
120    *         {@link ContentModelGroup}
121    **/
122   Enumeration<Particle> enumerate();
123 
124   /**
125    * Returns the element declaration with the given name, or null if no element declaration with
126    * that name exists in this {@link ContentModelGroup}.
127    *
128    * @param name the name of the element.
129    * @return the {@link ElementDecl} with the given name, or null if no ElementDecl exists in this
130    *         {@link ContentModelGroup}.
131    **/
132   ElementDecl getElementDecl(String name);
133 
134   /**
135    * Returns the maximum number of occurrences that this ContentModelGroup may appear.
136    * 
137    * @return the maximum number of occurrences that this ContentModelGroup may appear. A non
138    *         positive (n < 1) value indicates that the value is unspecified (ie. unbounded).
139    **/
140   int getMaxOccurs();
141 
142   /**
143    * Returns the minimum number of occurrences that this ContentModelGroup must appear.
144    * 
145    * @return the minimum number of occurrences that this ContentModelGroup must appear A negative (n
146    *         < 0) value indicates that the value is unspecified.
147    **/
148   int getMinOccurs();
149 
150   /**
151    * Returns the number of particles contained within this {@link ContentModelGroup}.
152    *
153    * @return the number of particles
154    **/
155   int getParticleCount();
156 
157   /**
158    * Returns the {@link Particle} at the specified index.
159    * 
160    * @param index the index of the {@link Particle} to return
161    * @return the CMParticle at the specified index
162    **/
163   Particle getParticle(int index);
164 
165 }