1 package com.thaiopensource.relaxng.impl; 2 3 import org.xml.sax.SAXException ; 4 5 abstract class BinaryPattern extends Pattern { 6 final Pattern p1; 7 final Pattern p2; 8 9 BinaryPattern(boolean nullable, int hc, Pattern p1, Pattern p2) { 10 super(nullable, Math.max(p1.getContentType(), p2.getContentType()), hc); 11 this.p1 = p1; 12 this.p2 = p2; 13 } 14 15 void checkRecursion(int depth) throws SAXException { 16 p1.checkRecursion(depth); 17 p2.checkRecursion(depth); 18 } 19 20 void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) 21 throws RestrictionViolationException { 22 p1.checkRestrictions(context, dad, alpha); 23 p2.checkRestrictions(context, dad, alpha); 24 } 25 26 boolean samePattern(Pattern other) { 27 if (getClass() != other.getClass()) 28 return false; 29 BinaryPattern b = (BinaryPattern)other; 30 return p1 == b.p1 && p2 == b.p2; 31 } 32 33 Pattern getOperand1() { 34 return p1; 35 } 36 37 Pattern getOperand2() { 38 return p2; 39 } 40 } 41 | Popular Tags |