KickJava   Java API By Example, From Geeks To Geeks.

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


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 NotationType. 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 NotationType 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     private List JavaDoc<String JavaDoc> enumerations;
47     
48     private List JavaDoc<Whitespace.Treatment> whitespaces;
49     
50     /**
51      * Creates a new instance of NotationType
52      */

53     public NotationType() {
54         super(Datatype.Kind.NOTATION);
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.remove(new Integer JavaDoc(length));
197     }
198     
199         /*
200          * set minimum length value (this corresponds to the value of minlength facet in schema)
201          *
202          * @param minLength
203          */

204     public void removeMinLength(int minLength) {
205         if(minLengths != null)
206             minLengths.remove(new Integer JavaDoc(minLength));
207     }
208     
209         /*
210          * set maximum length value (this corresponds to the value of maxlength facet in schema)
211          *
212          * @param maxLength
213          */

214     public void removeMaxLength(int maxLength) {
215         if(maxLengths != null)
216             maxLengths.remove(new Integer JavaDoc(maxLength));
217     }
218     
219         /*
220          * set pattern value (this corresponds to the value of pattern facet in schema)
221          *
222          * @param pattern
223          */

224     public void removePattern(String JavaDoc pattern) {
225         if(patterns != null)
226             patterns.remove(pattern);
227     }
228     
229         /*
230          * returns enumeration values (this corresponds to the values of enumeration facets in schema)
231          *
232          * @param enumeration
233          */

234     public void removeEnumeration(String JavaDoc enumeration) {
235         if(enumerations != null)
236             enumerations.remove(enumeration);
237     }
238     
239         /*
240          * set whitespace value (this corresponds to the value of whitespace facet in schema)
241          *
242          * @param whitespace
243          */

244     public void removeWhitespace(Whitespace.Treatment whitespace) {
245         if(whitespaces != null)
246             whitespaces.remove(whitespace);
247     }
248 }
249
Popular Tags