KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > axi > datatype > QNameType


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.xml.axi.datatype;
21
22 import java.util.ArrayList JavaDoc;
23 import java.util.List JavaDoc;
24 import org.netbeans.modules.xml.schema.model.Whitespace;
25
26 /**
27  * This class represents QNameType. This is one of those atomic types that can
28  * be used to type an Attribute or leaf Elements in AXI Model
29  *
30  *
31  *
32  * @author Ayub Khan
33  */

34 public class QNameType extends StringBase {
35     
36     protected boolean hasFacets;
37     
38     private List JavaDoc<Integer JavaDoc> lengths;
39     
40     private List JavaDoc<Integer JavaDoc> minLengths;
41     
42     private List JavaDoc<Integer JavaDoc> maxLengths;
43     
44     private List JavaDoc<String JavaDoc> patterns;
45     
46     protected List JavaDoc<String JavaDoc> enumerations;
47     
48     private List JavaDoc<Whitespace.Treatment> whitespaces;
49     
50     /**
51      * Creates a new instance of QNameType
52      */

53     public QNameType() {
54         super(Datatype.Kind.QNAME);
55     }
56     
57     /*
58      * returns length (this corresponds to the value of length facet in schema)
59      *
60      * @return length
61      */

62     public List JavaDoc<Integer JavaDoc> getLengths() {
63         return lengths;
64     }
65     
66     /*
67      * returns minimum length value (this corresponds to the value of minlength facet in schema)
68      *
69      * @return minLength
70      */

71     public List JavaDoc<Integer JavaDoc> getMinLengths() {
72         return minLengths;
73     }
74     
75     /*
76      * returns maximum length value (this corresponds to the value of maxlength facet in schema)
77      *
78      * @return maxLength
79      */

80     public List JavaDoc<Integer JavaDoc> getMaxLengths() {
81         return maxLengths;
82     }
83     
84     /*
85      * returns pattern value (this corresponds to the value of pattern facet in schema)
86      *
87      * @return pattern
88      */

89     public List JavaDoc<String JavaDoc> getPatterns() {
90         return patterns;
91     }
92     
93     /*
94      * returns enumeration values (this corresponds to the values of enumeration facets in schema)
95      *
96      * @return enumeration
97      */

98     public List JavaDoc<String JavaDoc> getEnumerations() {
99         return enumerations;
100     }
101     
102     /*
103      * returns whitespace value (this corresponds to the value of whitespace facet in schema)
104      *
105      * @return whitespaces
106      */

107     public List JavaDoc<Whitespace.Treatment> getWhiteSpaces() {
108         return whitespaces;
109     }
110     
111     /*
112      * set length (this corresponds to the value of length facet in schema)
113      *
114      * @param length
115      */

116     public void addLength(int length) {
117         if(lengths == null) {
118             lengths = new ArrayList JavaDoc<Integer JavaDoc>(1);
119             hasFacets = true;
120         }
121         this.lengths.add(new Integer JavaDoc(length));
122     }
123     
124     /*
125      * set minimum length value (this corresponds to the value of minlength facet in schema)
126      *
127      * @param minLength
128      */

129     public void addMinLength(int minLength) {
130         if(minLengths == null) {
131             minLengths = new ArrayList JavaDoc<Integer JavaDoc>(1);
132             hasFacets = true;
133         }
134         this.minLengths.add(new Integer JavaDoc(minLength));
135     }
136     
137     /*
138      * set maximum length value (this corresponds to the value of maxlength facet in schema)
139      *
140      * @param maxLength
141      */

142     public void addMaxLength(int maxLength) {
143         if(maxLengths == null) {
144             maxLengths = new ArrayList JavaDoc<Integer JavaDoc>(1);
145             hasFacets = true;
146         }
147         this.maxLengths.add(new Integer JavaDoc(maxLength));
148     }
149     
150     /*
151      * set pattern value (this corresponds to the value of pattern facet in schema)
152      *
153      * @param pattern
154      */

155     public void addPattern(String JavaDoc pattern) {
156         if(patterns == null) {
157             patterns = new ArrayList JavaDoc<String JavaDoc>(1);
158             hasFacets = true;
159         }
160         this.patterns.add(pattern);
161     }
162     
163     /*
164      * returns enumeration values (this corresponds to the values of enumeration facets in schema)
165      *
166      * @param enumeration
167      */

168     public void addEnumeration(String JavaDoc enumeration) {
169         if(enumerations == null) {
170             enumerations = new ArrayList JavaDoc<String JavaDoc>(1);
171             hasFacets = true;
172         }
173         this.enumerations.add(enumeration);
174     }
175     
176     /*
177      * set whitespace value (this corresponds to the value of whitespace facet in schema)
178      *
179      * @param whitespace
180      */

181     public void addWhitespace(Whitespace.Treatment whitespace) {
182         if(whitespaces == null) {
183             whitespaces = new ArrayList JavaDoc<Whitespace.Treatment>(1);
184             hasFacets = true;
185         }
186         this.whitespaces.add(whitespace);
187     }
188     
189     /*
190      * set length (this corresponds to the value of length facet in schema)
191      *
192      * @param length
193      */

194     public void removeLength(int length) {
195         if(lengths == null) {
196             lengths = new ArrayList JavaDoc<Integer JavaDoc>(1);
197             hasFacets = true;
198         }
199         this.lengths.remove(new Integer JavaDoc(length));
200     }
201     
202     /*
203      * set minimum length value (this corresponds to the value of minlength facet in schema)
204      *
205      * @param minLength
206      */

207     public void removeMinLength(int minLength) {
208         if(minLengths == null) {
209             minLengths = new ArrayList JavaDoc<Integer JavaDoc>(1);
210             hasFacets = true;
211         }
212         this.minLengths.remove(new Integer JavaDoc(minLength));
213     }
214     
215     /*
216      * set maximum length value (this corresponds to the value of maxlength facet in schema)
217      *
218      * @param maxLength
219      */

220     public void removeMaxLength(int maxLength) {
221         if(maxLengths == null) {
222             maxLengths = new ArrayList JavaDoc<Integer JavaDoc>(1);
223             hasFacets = true;
224         }
225         this.maxLengths.remove(new Integer JavaDoc(maxLength));
226     }
227     
228     /*
229      * set pattern value (this corresponds to the value of pattern facet in schema)
230      *
231      * @param pattern
232      */

233     public void removePattern(String JavaDoc pattern) {
234         if(patterns == null) {
235             patterns = new ArrayList JavaDoc<String JavaDoc>(1);
236             hasFacets = true;
237         }
238         this.patterns.remove(pattern);
239     }
240     
241     /*
242      * returns enumeration values (this corresponds to the values of enumeration facets in schema)
243      *
244      * @param enumeration
245      */

246     public void removeEnumeration(String JavaDoc enumeration) {
247         if(enumerations == null) {
248             enumerations = new ArrayList JavaDoc<String JavaDoc>(1);
249             hasFacets = true;
250         }
251         this.enumerations.remove(enumeration);
252     }
253     
254     /*
255      * set whitespace value (this corresponds to the value of whitespace facet in schema)
256      *
257      * @param whitespace
258      */

259     public void removeWhitespace(Whitespace.Treatment whitespace) {
260         if(whitespaces == null) {
261             whitespaces = new ArrayList JavaDoc<Whitespace.Treatment>(1);
262             hasFacets = true;
263         }
264         this.whitespaces.remove(whitespace);
265     }
266 }
267
Popular Tags