1 19 20 package org.netbeans.modules.xml.axi.datatype; 21 22 import java.util.ArrayList ; 23 import java.util.Collections ; 24 import java.util.List ; 25 import org.netbeans.modules.xml.axi.datatype.Datatype.Facet; 26 import org.netbeans.modules.xml.schema.model.Whitespace; 27 28 33 public abstract class TimeBase extends Datatype { 34 35 static List <Facet> applicableFacets; 36 37 private Datatype.Kind kind; 38 39 protected List <String > patterns; 40 41 protected List <String > enumerations; 42 43 protected List <Whitespace.Treatment> whitespaces; 44 45 protected List <String > maxInclusives; 46 47 protected List <String > maxExclusives; 48 49 protected List <String > minInclusives; 50 51 protected List <String > minExclusives; 52 53 private boolean hasFacets; 54 55 private boolean isList; 56 57 58 public TimeBase(Kind kind) { 59 this.kind = kind; 60 } 61 62 public Kind getKind() { 63 return kind; 64 } 65 66 public synchronized List <Facet> getApplicableFacets() { 67 if(applicableFacets == null) { 68 List <Facet> facets = new ArrayList <Facet>(); 69 facets.add(Facet.PATTERN); 70 facets.add(Facet.ENUMERATION); 71 facets.add(Facet.WHITESPACE); 72 facets.add(Facet.MAXINCLUSIVE); 73 facets.add(Facet.MAXEXCLUSIVE); 74 facets.add(Facet.MININCLUSIVE); 75 facets.add(Facet.MINEXCLUSIVE); 76 applicableFacets = Collections.unmodifiableList(facets); 77 } 78 return applicableFacets; 79 } 80 81 public boolean hasFacets() { 82 return hasFacets; 83 } 84 85 public boolean isList() { 86 return isList; 87 } 88 89 public void setIsList(boolean isList) { 90 this.isList = isList; 91 } 92 93 98 public List <String > getPatterns() { 99 return patterns; 100 } 101 102 107 public List <String > getEnumerations() { 108 return enumerations; 109 } 110 111 116 public List <Whitespace.Treatment> getWhiteSpaces() { 117 return whitespaces; 118 } 119 120 125 public List <String > getMaxInclusives() { 126 return maxInclusives; 127 } 128 129 134 public List <String > getMaxExclusives() { 135 return maxExclusives; 136 } 137 138 143 public List <String > getMinInclusives() { 144 return minInclusives; 145 } 146 147 152 public List <String > getMinExclusives() { 153 return minExclusives; 154 } 155 156 161 public void addPattern(String pattern) { 162 if(patterns == null) { 163 patterns = new ArrayList <String >(1); 164 hasFacets = true; 165 } 166 this.patterns.add(pattern); 167 } 168 169 174 public void addEnumeration(String enumeration) { 175 if(enumerations == null) { 176 enumerations = new ArrayList <String >(1); 177 hasFacets = true; 178 } 179 this.enumerations.add(enumeration); 180 } 181 182 187 public void addWhitespace(Whitespace.Treatment whitespace) { 188 if(whitespaces == null) { 189 whitespaces = new ArrayList <Whitespace.Treatment>(1); 190 hasFacets = true; 191 } 192 this.whitespaces.add(whitespace); 193 } 194 195 200 public void addMaxInclusive(String maxInclusive) { 201 if(maxInclusives == null) { 202 maxInclusives = new ArrayList <String >(1); 203 hasFacets = true; 204 } 205 this.maxInclusives.add(maxInclusive); 206 } 207 208 213 public void addMaxExclusive(String maxExclusive) { 214 if(maxExclusives == null) { 215 maxExclusives = new ArrayList <String >(1); 216 hasFacets = true; 217 } 218 this.maxExclusives.add(maxExclusive); 219 } 220 221 226 public void addMinInclusive(String minInclusive) { 227 if(minInclusives == null) { 228 minInclusives = new ArrayList <String >(1); 229 hasFacets = true; 230 } 231 this.minInclusives.add(minInclusive); 232 } 233 234 239 public void addMinExclusive(String minExclusive) { 240 if(minExclusives == null) { 241 minExclusives = new ArrayList <String >(1); 242 hasFacets = true; 243 } 244 this.minExclusives.add(minExclusive); 245 } 246 247 252 public void removePattern(String pattern) { 253 if(patterns != null) 254 patterns.remove(pattern); 255 } 256 257 262 public void removeEnumeration(String enumeration) { 263 if(enumerations != null) 264 enumerations.remove(enumeration); 265 } 266 267 272 public void removeWhitespace(Whitespace.Treatment whitespace) { 273 if(whitespaces != null) 274 whitespaces.remove(whitespace); 275 } 276 277 282 public void removeMaxInclusive(String maxInclusive) { 283 if(maxInclusives != null) 284 maxInclusives.remove(maxInclusive); 285 } 286 287 292 public void removeMaxExclusive(String maxExclusive) { 293 if(maxExclusives != null) 294 maxExclusives.remove(maxExclusive); 295 } 296 297 302 public void removeMinInclusive(String minInclusive) { 303 if(minInclusives != null) 304 minInclusives.remove(minInclusive); 305 } 306 307 312 public void removeMinExclusive(String minExclusive) { 313 if(minExclusives != null) 314 minExclusives.remove(minExclusive); 315 } 316 } 317 | Popular Tags |