01: package org.kohsuke.rngom.binary;
02:
03: import org.kohsuke.rngom.nc.ChoiceNameClass;
04: import org.kohsuke.rngom.nc.NameClass;
05:
06: class Alphabet {
07: private NameClass nameClass;
08:
09: boolean isEmpty() {
10: return nameClass == null;
11: }
12:
13: void addElement(NameClass nc) {
14: if (nameClass == null)
15: nameClass = nc;
16: else if (nc != null)
17: nameClass = new ChoiceNameClass(nameClass, nc);
18: }
19:
20: void addAlphabet(Alphabet a) {
21: addElement(a.nameClass);
22: }
23:
24: void checkOverlap(Alphabet a) throws RestrictionViolationException {
25: if (nameClass != null && a.nameClass != null
26: && nameClass.hasOverlapWith(a.nameClass))
27: throw new RestrictionViolationException(
28: "interleave_element_overlap");
29: }
30: }
|