@Override public boolean valid() { boolean valid = true; if (match == null || "".equals(match)) { error(node, "Match expression on p:viewport must be specified.", XProcConstants.staticError(38)); valid = false; } if (outputs.size() == 1) { error(node, "A viewport step must have a primary output", XProcConstants.staticError(6)); } if (!super.valid()) { valid = false; } return valid; } }
@Override public void patchEnvironment(Environment env) { env.setDefaultReadablePort(getOutput("#current")); }
private Viewport readViewport(Step parent, XdmNode node) { QName name = node.getNodeName(); if (!XProcConstants.p_viewport.equals(name)) { throw new UnsupportedOperationException("Can't parse " + name + " as a pipeline!"); } checkAttributes(node, new String[] { "name", "match" }, false); String stepName = checkNCName(node.getAttributeValue(_name)); RuntimeValue match = new RuntimeValue(node.getAttributeValue(new QName("match")), node); Viewport step = new Viewport(runtime, node, stepName); checkExtensionAttributes(node, step); step.setParentDecl((DeclareStep) parent); step.parent = parent; step.setMatch(match); Vector<XdmNode> rest = readSignature(step); if (rest == null) { throw XProcException.staticError(15, node, "A p:viewport must contain a subpipeline."); } for (XdmNode substepNode : rest) { Step substep = readStep(step, substepNode); step.addStep(substep); } step.checkPrimaryIO(); return step; }
public Viewport(XProcRuntime xproc, XdmNode node, String name) { super(xproc, node, name); declaration = this; stepType = XProcConstants.p_viewport; Output current = new Output(xproc, node); current.setPort("#current"); addOutput(current); }
RuntimeValue match = ((Viewport) step).getMatch();
private Viewport readViewport(Step parent, XdmNode node) { QName name = node.getNodeName(); if (!XProcConstants.p_viewport.equals(name)) { throw new UnsupportedOperationException("Can't parse " + name + " as a pipeline!"); } checkAttributes(node, new String[] { "name", "match" }, false); String stepName = checkNCName(node.getAttributeValue(_name)); RuntimeValue match = new RuntimeValue(node.getAttributeValue(new QName("match")), node); Viewport step = new Viewport(runtime, node, stepName); checkExtensionAttributes(node, step); step.setParentDecl((DeclareStep) parent); step.parent = parent; step.setMatch(match); Vector<XdmNode> rest = readSignature(step); if (rest == null) { throw XProcException.staticError(15, node, "A p:viewport must contain a subpipeline."); } for (XdmNode substepNode : rest) { Step substep = readStep(step, substepNode); step.addStep(substep); } step.checkPrimaryIO(); return step; }
public Viewport(XProcRuntime xproc, XdmNode node, String name) { super(xproc, node, name); declaration = this; stepType = XProcConstants.p_viewport; Output current = new Output(xproc, node); current.setPort("#current"); addOutput(current); }
RuntimeValue match = ((Viewport) step).getMatch();
@Override public void patchEnvironment(Environment env) { env.setDefaultReadablePort(getOutput("#current")); }
@Override public boolean valid() { boolean valid = true; if (match == null || "".equals(match)) { error(node, "Match expression on p:viewport must be specified.", XProcConstants.staticError(38)); valid = false; } if (outputs.size() == 1) { error(node, "A viewport step must have a primary output", XProcConstants.staticError(6)); } if (!super.valid()) { valid = false; } return valid; } }
public Output getOutput(String portName) { if ("current".equals(portName)) { return getOutput("#current"); } else if ("result".equals(portName)) { for (Output output: outputs) { if (!"#current".equals(output.getPort())) { return output; } } return null; } else { return super.getOutput(portName); } }
public Output getOutput(String portName) { if ("current".equals(portName)) { return getOutput("#current"); } else if ("result".equals(portName)) { for (Output output: outputs) { if (!"#current".equals(output.getPort())) { return output; } } return null; } else { return super.getOutput(portName); } }