001 package com.thaiopensource.relaxng.impl;
002
003 import org.relaxng.datatype.ValidationContext;
004
005 /**
006 * DerivType for a Pattern whose derivative wrt any data is always the same.
007 */
008 class SingleDataDerivType extends DataDerivType {
009 private PatternMemo memo;
010
011 SingleDataDerivType() { }
012
013 PatternMemo dataDeriv(ValidatorPatternBuilder builder, Pattern p, String str, ValidationContext vc) {
014 if (memo == null)
015 memo = super.dataDeriv(builder, p, str, vc);
016 return memo;
017 }
018
019 DataDerivType copy() {
020 return new SingleDataDerivType();
021 }
022
023 DataDerivType combine(DataDerivType ddt) {
024 return ddt;
025 }
026 }