void checkRecursion(int depth) throws SAXException { p1.checkRecursion(depth); p2.checkRecursion(depth); }
void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) throws RestrictionViolationException { p1.checkRestrictions(context, dad, alpha); p2.checkRestrictions(context, dad, alpha); }
Pattern expand(SchemaPatternBuilder b) { if (!expanded) { expanded = true; p = p.expand(b); if (p.isNotAllowed()) nameClass = NameClass.NULL; } return this; }
public ParsedPattern expandPattern(ParsedPattern _pattern) throws BuildException, IllegalSchemaException { Pattern pattern = (Pattern) _pattern; if (!hadError) { try { pattern.checkRecursion(0); pattern = pattern.expand(pb); pattern.checkRestrictions(Pattern.START_CONTEXT, null, null); if (!hadError) return pattern; } catch (SAXParseException e) { error(e); } catch (SAXException e) { throw new BuildException(e); } catch (RestrictionViolationException e) { if (e.getName() != null) error(e.getMessageId(), e.getName().toString(), e .getLocator()); else error(e.getMessageId(), e.getLocator()); } } throw new IllegalSchemaException(); }
@Override void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) throws RestrictionViolationException { switch (context) { case START_CONTEXT: throw new RestrictionViolationException("start_contains_one_or_more"); case DATA_EXCEPT_CONTEXT: throw new RestrictionViolationException("data_except_contains_one_or_more"); } p.checkRestrictions(context == ELEMENT_CONTEXT ? ELEMENT_REPEAT_CONTEXT : context, dad, alpha); if (context != LIST_CONTEXT && !contentTypeGroupable(p.getContentType(), p.getContentType())) throw new RestrictionViolationException("one_or_more_string"); }
Pattern expand(SchemaPatternBuilder b) { if (!expanded) { p = p.expand(b); expanded = true; } return p; }
GroupPattern(Pattern p1, Pattern p2) { super(p1.isNullable() && p2.isNullable(), combineHashCode(GROUP_HASH_CODE, p1.hashCode(), p2.hashCode()), p1, p2); }
OneOrMorePattern(Pattern p) { super(p.isNullable(), p.getContentType(), combineHashCode(ONE_OR_MORE_HASH_CODE, p.hashCode())); this.p = p; }
BinaryPattern(boolean nullable, int hc, Pattern p1, Pattern p2) { super(nullable, Math.max(p1.getContentType(), p2.getContentType()), hc); this.p1 = p1; this.p2 = p2; }
boolean samePattern(Pattern other) { if (!super.samePattern(other)) return false; return except.samePattern(((DataExceptPattern)other).except); }
boolean isNotAllowed() { return p1.isNotAllowed(); }
boolean containsChoice(Pattern p) { return p1.containsChoice(p) || p2.containsChoice(p); }
private int firstIndex(Pattern p) { return p.patternHashCode() & (table.length - 1); }
public ParsedPattern expandPattern(ParsedPattern _pattern) throws BuildException, IllegalSchemaException { Pattern pattern = (Pattern) _pattern; if (!hadError) { try { pattern.checkRecursion(0); pattern = pattern.expand(pb); pattern.checkRestrictions(Pattern.START_CONTEXT, null, null); if (!hadError) { return pattern; } } catch (SAXParseException e) { error(e); } catch (SAXException e) { throw new BuildException(e); } catch (RestrictionViolationException e) { if (e.getName() != null) { error(e.getMessageId(), e.getName().toString(), e .getLocator()); } else { error(e.getMessageId(), e.getLocator()); } } } throw new IllegalSchemaException(); }
void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) throws RestrictionViolationException { switch (context) { case START_CONTEXT: throw new RestrictionViolationException("start_contains_one_or_more"); case DATA_EXCEPT_CONTEXT: throw new RestrictionViolationException("data_except_contains_one_or_more"); } p.checkRestrictions(context == ELEMENT_CONTEXT ? ELEMENT_REPEAT_CONTEXT : context, dad, alpha); if (context != LIST_CONTEXT && !contentTypeGroupable(p.getContentType(), p.getContentType())) throw new RestrictionViolationException("one_or_more_string"); }
@Override Pattern expand(SchemaPatternBuilder b) { if (!expanded) { p = p.expand(b); expanded = true; } return p; }
@Override Pattern expand(SchemaPatternBuilder b) { if (!expanded) { expanded = true; p = p.expand(b); if (p.isNotAllowed()) nameClass = NameClass.NULL; } return this; }
ChoicePattern(Pattern p1, Pattern p2) { super(p1.isNullable() || p2.isNullable(), combineHashCode(CHOICE_HASH_CODE, p1.hashCode(), p2.hashCode()), p1, p2); } Pattern expand(SchemaPatternBuilder b) {
OneOrMorePattern(Pattern p) { super(p.isNullable(), p.getContentType(), combineHashCode(ONE_OR_MORE_HASH_CODE, p.hashCode())); this.p = p; }