KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.thaiopensource.relaxng.impl;
2
3 import org.relaxng.datatype.ValidationContext;
4
5 class BlankDataDerivType extends DataDerivType {
6   private PatternMemo blankMemo;
7   private PatternMemo nonBlankMemo;
8
9   BlankDataDerivType() { }
10
11   PatternMemo dataDeriv(ValidatorPatternBuilder builder, Pattern p, String JavaDoc str, ValidationContext vc) {
12     if (DataDerivFunction.isBlank(str)) {
13       if (blankMemo == null)
14         blankMemo = super.dataDeriv(builder, p, str, vc);
15       return blankMemo;
16     }
17     else {
18       if (nonBlankMemo == null)
19         nonBlankMemo = super.dataDeriv(builder, p, str, vc);
20       return nonBlankMemo;
21     }
22   }
23
24   DataDerivType copy() {
25     return new BlankDataDerivType();
26   }
27
28   DataDerivType combine(DataDerivType ddt) {
29     if (ddt instanceof BlankDataDerivType || ddt instanceof SingleDataDerivType)
30       return this;
31     return InconsistentDataDerivType.getInstance();
32   }
33 }
Popular Tags