![JAR search and dependency download from the Maven repository](/logo.png)
com.thaiopensource.relaxng.impl.FeasibleTransform Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jing Show documentation
Show all versions of jing Show documentation
A branch of Jing used by the Nu Html Checker. (Jing is a tool for validating documents against RelaxNG schemas.)
The newest version!
package com.thaiopensource.relaxng.impl;
import java.util.HashMap;
import java.util.Map;
public class FeasibleTransform {
private static class FeasiblePatternFunction extends AbstractPatternFunction {
private final SchemaPatternBuilder spb;
private final Map elementTable = new HashMap();
FeasiblePatternFunction(SchemaPatternBuilder spb) {
this.spb = spb;
}
public Object caseChoice(ChoicePattern p) {
return spb.makeChoice(p.getOperand1().applyForPattern(this), p.getOperand2().applyForPattern(this));
}
public Object caseGroup(GroupPattern p) {
return spb.makeGroup(p.getOperand1().applyForPattern(this), p.getOperand2().applyForPattern(this));
}
public Object caseInterleave(InterleavePattern p) {
return spb.makeInterleave(p.getOperand1().applyForPattern(this), p.getOperand2().applyForPattern(this));
}
public Object caseOneOrMore(OneOrMorePattern p) {
return spb.makeOneOrMore(p.getOperand().applyForPattern(this));
}
public Object caseElement(ElementPattern p) {
if (elementTable.get(p) == null) {
elementTable.put(p, p);
p.setContent(p.getContent().applyForPattern(this));
}
return spb.makeOptional(p);
}
public Object caseOther(Pattern p) {
return spb.makeOptional(p);
}
}
public static Pattern transform(SchemaPatternBuilder spb, Pattern p) {
return p.applyForPattern(new FeasiblePatternFunction(spb));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy