1 /*
2  * reserved comment block
3  * DO NOT REMOVE OR ALTER!
4  */
5 /*
6  * Licensed to the Apache Software Foundation (ASF) under one or more
7  * contributor license agreements.  See the NOTICE file distributed with
8  * this work for additional information regarding copyright ownership.
9  * The ASF licenses this file to You under the Apache License, Version 2.0
10  * (the "License"); you may not use this file except in compliance with
11  * the License.  You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 package com.sun.org.apache.xerces.internal.xs;
23 
24 /**
25  * This interface represents the Simple Type Definition schema component. This
26  * interface provides several query operations for facet components. Users
27  * can either retrieve the defined facets as XML Schema components, using
28  * the <code>facets</code> and the <code>multiValueFacets</code> attributes;
29  * or users can separately query a facet's properties using methods such as
30  * <code>getLexicalFacetValue</code>, <code>isFixedFacet</code>, etc.
31  */
32 public interface XSSimpleTypeDefinition extends XSTypeDefinition {
33     // Variety definitions
34     /**
35      * The variety is absent for the anySimpleType definition.
36      */
37     public static final short VARIETY_ABSENT            = 0;
38     /**
39      * <code>Atomic</code> type.
40      */
41     public static final short VARIETY_ATOMIC            = 1;
42     /**
43      * <code>List</code> type.
44      */
45     public static final short VARIETY_LIST              = 2;
46     /**
47      * <code>Union</code> type.
48      */
49     public static final short VARIETY_UNION             = 3;
50 
51     // Facets
52     /**
53      * No facets defined.
54      */
55     public static final short FACET_NONE                = 0;
56     /**
57      * 4.3.1 Length
58      */
59     public static final short FACET_LENGTH              = 1;
60     /**
61      * 4.3.2 minLength.
62      */
63     public static final short FACET_MINLENGTH           = 2;
64     /**
65      * 4.3.3 maxLength.
66      */
67     public static final short FACET_MAXLENGTH           = 4;
68     /**
69      * 4.3.4 pattern.
70      */
71     public static final short FACET_PATTERN             = 8;
72     /**
73      * 4.3.5 whitespace.
74      */
75     public static final short FACET_WHITESPACE          = 16;
76     /**
77      * 4.3.7 maxInclusive.
78      */
79     public static final short FACET_MAXINCLUSIVE        = 32;
80     /**
81      * 4.3.9 maxExclusive.
82      */
83     public static final short FACET_MAXEXCLUSIVE        = 64;
84     /**
85      * 4.3.9 minExclusive.
86      */
87     public static final short FACET_MINEXCLUSIVE        = 128;
88     /**
89      * 4.3.10 minInclusive.
90      */
91     public static final short FACET_MININCLUSIVE        = 256;
92     /**
93      * 4.3.11 totalDigits .
94      */
95     public static final short FACET_TOTALDIGITS         = 512;
96     /**
97      * 4.3.12 fractionDigits.
98      */
99     public static final short FACET_FRACTIONDIGITS      = 1024;
100     /**
101      * 4.3.5 enumeration.
102      */
103     public static final short FACET_ENUMERATION         = 2048;
104 
105     /**
106      * A constant defined for the 'ordered' fundamental facet: not ordered.
107      */
108     public static final short ORDERED_FALSE             = 0;
109     /**
110      * A constant defined for the 'ordered' fundamental facet: partially
111      * ordered.
112      */
113     public static final short ORDERED_PARTIAL           = 1;
114     /**
115      * A constant defined for the 'ordered' fundamental facet: total ordered.
116      */
117     public static final short ORDERED_TOTAL             = 2;
118     /**
119      * [variety]: one of {atomic, list, union} or absent.
120      */
getVariety()121     public short getVariety();
122 
123     /**
124      * If variety is <code>atomic</code> the primitive type definition (a
125      * built-in primitive datatype definition or the simple ur-type
126      * definition) is available, otherwise <code>null</code>.
127      */
getPrimitiveType()128     public XSSimpleTypeDefinition getPrimitiveType();
129 
130     /**
131      * Returns the closest built-in type category this type represents or
132      * derived from. For example, if this simple type is a built-in derived
133      * type integer the <code>INTEGER_DV</code> is returned.
134      */
getBuiltInKind()135     public short getBuiltInKind();
136 
137     /**
138      * If variety is <code>list</code> the item type definition (an atomic or
139      * union simple type definition) is available, otherwise
140      * <code>null</code>.
141      */
getItemType()142     public XSSimpleTypeDefinition getItemType();
143 
144     /**
145      * If variety is <code>union</code> the list of member type definitions (a
146      * non-empty sequence of simple type definitions) is available,
147      * otherwise an empty <code>XSObjectList</code>.
148      */
getMemberTypes()149     public XSObjectList getMemberTypes();
150 
151     /**
152      * [facets]: all facets defined on this type. The value is a bit
153      * combination of FACET_XXX constants of all defined facets.
154      */
getDefinedFacets()155     public short getDefinedFacets();
156 
157     /**
158      * Convenience method. [Facets]: check whether a facet is defined on this
159      * type.
160      * @param facetName  The name of the facet.
161      * @return  True if the facet is defined, false otherwise.
162      */
isDefinedFacet(short facetName)163     public boolean isDefinedFacet(short facetName);
164 
165     /**
166      * [facets]: all defined facets for this type which are fixed.
167      */
getFixedFacets()168     public short getFixedFacets();
169 
170     /**
171      * Convenience method. [Facets]: check whether a facet is defined and
172      * fixed on this type.
173      * @param facetName  The name of the facet.
174      * @return  True if the facet is fixed, false otherwise.
175      */
isFixedFacet(short facetName)176     public boolean isFixedFacet(short facetName);
177 
178     /**
179      * Convenience method. Returns a value of a single constraining facet for
180      * this simple type definition. This method must not be used to retrieve
181      * values for <code>enumeration</code> and <code>pattern</code> facets.
182      * @param facetName The name of the facet, i.e.
183      *   <code>FACET_LENGTH, FACET_TOTALDIGITS</code>.
184      *   To retrieve the value for a pattern or
185      *   an enumeration, see <code>enumeration</code> and
186      *   <code>pattern</code>.
187      * @return A value of the facet specified in <code>facetName</code> for
188      *   this simple type definition or <code>null</code>.
189      */
getLexicalFacetValue(short facetName)190     public String getLexicalFacetValue(short facetName);
191 
192     /**
193      * A list of enumeration values if it exists, otherwise an empty
194      * <code>StringList</code>.
195      */
getLexicalEnumeration()196     public StringList getLexicalEnumeration();
197 
198     /**
199      * A list of pattern values if it exists, otherwise an empty
200      * <code>StringList</code>.
201      */
getLexicalPattern()202     public StringList getLexicalPattern();
203 
204     /**
205      *  Fundamental Facet: ordered.
206      */
getOrdered()207     public short getOrdered();
208 
209     /**
210      * Fundamental Facet: cardinality.
211      */
getFinite()212     public boolean getFinite();
213 
214     /**
215      * Fundamental Facet: bounded.
216      */
getBounded()217     public boolean getBounded();
218 
219     /**
220      * Fundamental Facet: numeric.
221      */
getNumeric()222     public boolean getNumeric();
223 
224     /**
225      *  A list of constraining facets if it exists, otherwise an empty
226      * <code>XSObjectList</code>. Note: This method must not be used to
227      * retrieve values for <code>enumeration</code> and <code>pattern</code>
228      * facets.
229      */
getFacets()230     public XSObjectList getFacets();
231 
232     /**
233      *  A list of enumeration and pattern constraining facets if it exists,
234      * otherwise an empty <code>XSObjectList</code>.
235      */
getMultiValueFacets()236     public XSObjectList getMultiValueFacets();
237 
238     /**
239      * A constraining facet object. An instance of XSFacet or XSMultiValueFacet.
240      */
getFacet(int facetType)241     public XSObject getFacet(int facetType);
242 
243     /**
244      * A sequence of [annotations] or an empty <code>XSObjectList</code>.
245      */
getAnnotations()246     public XSObjectList getAnnotations();
247 
248 }
249