KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > relaxng > impl > Alphabet


1 package com.thaiopensource.relaxng.impl;
2
3 class Alphabet {
4   private NameClass nameClass;
5
6   boolean isEmpty() {
7     return nameClass == null;
8   }
9
10   void addElement(NameClass nc) {
11     if (nameClass == null)
12       nameClass = nc;
13     else if (nc != null)
14       nameClass = new ChoiceNameClass(nameClass, nc);
15   }
16
17   void addAlphabet(Alphabet a) {
18     addElement(a.nameClass);
19   }
20
21   void checkOverlap(Alphabet a) throws RestrictionViolationException {
22     if (nameClass != null
23     && a.nameClass != null
24     && OverlapDetector.overlap(nameClass, a.nameClass))
25       throw new RestrictionViolationException("interleave_element_overlap");
26   }
27 }
28
Popular Tags