KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ws > jaxme > xs > XSParticle


1 /*
2  * Copyright 2003, 2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15
16  */

17 package org.apache.ws.jaxme.xs;
18
19 import org.xml.sax.Locator JavaDoc;
20
21
22 /** <p>Interface of a model groups particle.</p>
23  *
24  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
25  */

26 public interface XSParticle {
27   public class Type {
28     private final String JavaDoc name;
29     public Type(String JavaDoc pName) {
30       name = pName;
31     }
32     public String JavaDoc toString() { return name; }
33     public boolean equals(Object JavaDoc o) {
34       return o != null && o instanceof Type && ((Type) o).name.equals(name);
35     }
36     public int hashCode() { return name.hashCode(); }
37   }
38
39   /** <p>The particle type "group".</p>
40    */

41   public Type GROUP = new Type("group");
42
43   /** <p>The particle type "wildcard".</p>
44    */

45   public Type WILDCARD = new Type("wildcard");
46
47   /** <p>The particle type "element".</p>
48    */

49   public Type ELEMENT = new Type("element");
50
51   /** <p>Returns the particle type.</p>
52    */

53   public Type getType();
54
55   /** <p>Shortcut for <code>getType().equals(GROUP)</code>.</p>
56    * @see #getType()
57    * @see #GROUP
58    */

59   public boolean isGroup();
60
61   /** <p>If the particle type is group: Returns the group.</p>
62    * @throws IllegalStateException {@link #isGroup()} returns false
63    */

64   public XSGroup getGroup();
65
66   /** <p>Shortcut for <code>getType().equals(WILDCARD)</code>.</p>
67    * @see #getType()
68    * @see #WILDCARD
69    */

70   public boolean isWildcard();
71
72   /** <p>If the particle type is wildcard: Returns the wildcard.</p>
73    * @throws IllegalStateException {@link #isWildcard()} returns false
74    */

75   public XSAny getWildcard();
76
77   /** <p>Shortcut for <code>getType().equals(ELEMENT)</code>.</p>
78    * @see #getType()
79    * @see #ELEMENT
80    */

81   public boolean isElement();
82
83   /** <p>If the particle type is element: Returns the element.</p>
84    * @throws IllegalStateException {@link #isElement()} returns false
85    */

86   public XSElement getElement();
87
88   /** <p>Returns the particles minOccurs value.</p>
89    */

90   public int getMinOccurs();
91
92   /** <p>Returns the particles maxOccurs value or -1 for unbounded.</p>
93    */

94   public int getMaxOccurs();
95
96   /** <p>Returns the particles Locator.</p>
97    */

98   public Locator JavaDoc getLocator();
99 }
100
Popular Tags