001 package com.thaiopensource.relaxng.impl; 002 003 import org.relaxng.datatype.ValidationContext; 004 005 class BlankDataDerivType extends DataDerivType { 006 private PatternMemo blankMemo; 007 private PatternMemo nonBlankMemo; 008 009 BlankDataDerivType() { } 010 011 PatternMemo dataDeriv(ValidatorPatternBuilder builder, Pattern p, String str, ValidationContext vc) { 012 if (DataDerivFunction.isBlank(str)) { 013 if (blankMemo == null) 014 blankMemo = super.dataDeriv(builder, p, str, vc); 015 return blankMemo; 016 } 017 else { 018 if (nonBlankMemo == null) 019 nonBlankMemo = super.dataDeriv(builder, p, str, vc); 020 return nonBlankMemo; 021 } 022 } 023 024 DataDerivType copy() { 025 return new BlankDataDerivType(); 026 } 027 028 DataDerivType combine(DataDerivType ddt) { 029 if (ddt instanceof BlankDataDerivType || ddt instanceof SingleDataDerivType) 030 return this; 031 return InconsistentDataDerivType.getInstance(); 032 } 033 }