Package org.pdf4j.saxon.instruct

Examples of org.pdf4j.saxon.instruct.Block


                base = new AxisExpression(Axis.DESCENDANT, NodeKindTest.makeNodeKindTest(kind));
                break;

            case Type.NODE:
                Expression allChildren = new AxisExpression(Axis.DESCENDANT, NodeKindTest.ELEMENT);
                Block block = new Block();
                Expression[] union = {new ContextItemExpression(),
                                      new AxisExpression(Axis.ATTRIBUTE, AnyNodeTest.getInstance())};
                block.setChildren(union);
                base = new PathExpression(allChildren, block);
                break;

            case Type.NAMESPACE:
               throw new UnsupportedOperationException("Patterns can't match namespace nodes");
View Full Code Here


                return Closure.make(tail, context, ref);
            }

            case SHARED_APPEND_EXPRESSION: {
                if (exp instanceof Block) {
                    Block block = (Block)exp;
                    Expression base = block.getChildren()[0];
                    Value baseVal;
                    if (base instanceof Literal) {
                        baseVal = ((Literal)base).getValue();
                    } else if (base instanceof VariableReference) {
                        baseVal = Value.asValue(evaluate(base, EVALUATE_VARIABLE, context, ref));
                        if (baseVal instanceof MemoClosure && ((MemoClosure)baseVal).isFullyRead()) {
                            baseVal = ((MemoClosure)baseVal).materialize();
                        }
                    } else {
                        throw new AssertionError("base of shared append expression is of class " + base.getClass());
                    }
                    if (baseVal instanceof ShareableSequence && ((ShareableSequence)baseVal).isShareable()) {
                        List list = ((ShareableSequence)baseVal).getList();
                        SequenceIterator iter = block.getChildren()[1].iterate(context);
                        while (true) {
                            Item i = iter.next();
                            if (i == null) {
                                break;
                            }
                            list.add(i);
                        }
                        return new ShareableSequence(list);
                    } else {
                        List list = new ArrayList(20);
                        SequenceIterator iter = baseVal.iterate();
                        while (true) {
                            Item i = iter.next();
                            if (i == null) {
                                break;
                            }
                            list.add(i);
                        }
                        iter = block.getChildren()[1].iterate(context);
                        while (true) {
                            Item i = iter.next();
                            if (i == null) {
                                break;
                            }
View Full Code Here

        // Convert @*|node() into @*,node() to eliminate the sorted merge operation
        if (operator == Token.UNION && operand0 instanceof AxisExpression && operand1 instanceof AxisExpression) {
            AxisExpression a0 = (AxisExpression)operand0;
            AxisExpression a1 = (AxisExpression)operand1;
            if (a0.getAxis() == Axis.ATTRIBUTE && a1.getAxis() == Axis.CHILD) {
                Block b = new Block();
                b.setChildren(new Expression[]{operand0, operand1});
                return b;
            } else if (a1.getAxis() == Axis.ATTRIBUTE && a0.getAxis() == Axis.CHILD) {
                Block b = new Block();
                b.setChildren(new Expression[]{operand1, operand0});
                return b;
            }
        }
        return this;
    }
View Full Code Here

TOP

Related Classes of org.pdf4j.saxon.instruct.Block

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.