Package org.pdf4j.saxon.sort

Examples of org.pdf4j.saxon.sort.IntHashSet$IntHashSetIterator


    public synchronized int[] getSlotsUsed() {
        // synchronized because it's calculated lazily at run-time the first time it's needed
        if (slotsUsed != null) {
            return slotsUsed;
        }
        IntHashSet slots = new IntHashSet(10);
        gatherSlotsUsed(this, slots);
        slotsUsed = new int[slots.size()];
        int i=0;
        IntIterator iter = slots.iterator();
        while (iter.hasNext()) {
            slotsUsed[i++] = iter.next();
        }
        Arrays.sort(slotsUsed);
        return slotsUsed;
View Full Code Here


                                config.getNamePool().getClarkName(att1.getFingerprint()), flags);
                        return false;
                    }
                }
                if ((flags & INCLUDE_NAMESPACES) != 0) {
                    IntHashSet ns1 = new IntHashSet(10);
                    IntHashSet ns2 = new IntHashSet(10);
                    AxisIterator it1 = n1.iterateAxis(Axis.NAMESPACE);
                    while (true) {
                        NodeInfo nn1 = (NodeInfo)it1.next();
                        if (nn1 == null) {
                            break;
                        }
                        int nscode1 = pool.getNamespaceCode(nn1.getLocalPart(), nn1.getStringValue());
                        ns1.add(nscode1);
                    }
                    AxisIterator it2 = n2.iterateAxis(Axis.NAMESPACE);
                    while (true) {
                        NodeInfo nn2 = (NodeInfo)it2.next();
                        if (nn2 == null) {
                            break;
                        }
                        int nscode2 = pool.getNamespaceCode(nn2.getLocalPart(), nn2.getStringValue());
                        ns2.add(nscode2);
                    }
                    if (!ns1.equals(ns2)) {
                        explain(config, "elements have different in-scope namespaces", flags);
                        return false;
                    }
View Full Code Here

        } else if (typeCode < 1024) {
            // No other built-in type is an ID
            return false;
        } else {
            if (nonIDs == null) {
                nonIDs = new IntHashSet(20);
            }
            if (nonIDs.contains(typeCode)) {
                return false;
            }
            SchemaType type = getConfiguration().getSchemaType(typeCode);
View Full Code Here

        String omit = props.getProperty(OutputKeys.OMIT_XML_DECLARATION);
        afterEndTag = omit==null || !Whitespace.trim(omit).equals("yes") ||
                    props.getProperty(OutputKeys.DOCTYPE_SYSTEM)!=null ;
        s = props.getProperty(SaxonOutputKeys.SUPPRESS_INDENTATION);
        if (s != null) {
            suppressedElements = new IntHashSet(8);
            NamePool pool = getNamePool();
            StringTokenizer st = new StringTokenizer(s, " \t\r\n");
            while (st.hasMoreTokens()) {
                String clarkName = st.nextToken();
                int fp = pool.allocateClarkName(clarkName);
                suppressedElements.add(fp);
            }
        }
        s = props.getProperty(SaxonOutputKeys.DOUBLE_SPACE);
        if (s != null) {
            doubleSpacedElements = new IntHashSet(8);
            NamePool pool = getNamePool();
            StringTokenizer st = new StringTokenizer(s, " \t\r\n");
            while (st.hasMoreTokens()) {
                String clarkName = st.nextToken();
                int fp = pool.allocateClarkName(clarkName);
View Full Code Here

     */

    protected int classifyTag(int nameCode) {
        if (inlineTagSet == null) {
            NamePool pool = getNamePool();
            inlineTagSet = new IntHashSet(50);
            formattedTagSet = new IntHashSet(10);
            for (int i=0; i<inlineTags.length; i++) {
                int nc = pool.allocate("", NamespaceConstant.XHTML, inlineTags[i]);
                inlineTagSet.add(nc);
            }
            for (int i=0; i<formattedTags.length; i++) {
View Full Code Here

        boolean first = true;
        if (test instanceof AnyNodeTest || test == NodeKindTest.NAMESPACE) {
            test = null;
        }
        AxisIterator result = null;
        IntHashSet declared = null;
        IntHashSet undeclared = null;
        int[] buffer = new int[8];
        NodeInfo node = element;

        while (node != null && node.getNodeKind() == Type.ELEMENT) {

            int[] nslist = node.getDeclaredNamespaces(buffer);
            if (nslist != null) {
                for (int i=0; i<nslist.length; i++) {
                    if (nslist[i] ==-1) {
                        break;
                    }
                    if (first) {
                        NamespaceIterator nsi = new NamespaceIterator();
                        nsi.element = element;
                        nsi.test = test;
                        nsi.index = -1;
                        undeclared = new IntHashSet(8);
                        declared = new IntHashSet(8);
                        declared.add(NamespaceConstant.XML_NAMESPACE_CODE);
                        first = false;
                        result = nsi;
                    }
                    short uriCode = (short)(nslist[i] & 0xffff);
                    short prefixCode = (short)(nslist[i] >> 16);
                    if (uriCode == 0) {
                        // this is an undeclaration
                        undeclared.add(prefixCode);
                    } else {
                        if (!undeclared.contains(prefixCode)) {
                            declared.add(nslist[i]);
                            undeclared.add(prefixCode);
                        }
                    }
                }
            }
            node = node.getParent();
View Full Code Here

     * @return the list of in scope namespaces
     */

    public static int[] getInScopeNamespaceCodes(NodeInfo element) {
        boolean first = true;
        IntHashSet declared = null;
        IntHashSet undeclared = null;
        int[] buffer = new int[8];
        NodeInfo node = element;

        while (node != null && node.getNodeKind() == Type.ELEMENT) {

            int[] nslist = node.getDeclaredNamespaces(buffer);
            if (nslist != null) {
                for (int i=0; i<nslist.length; i++) {
                    if (nslist[i] ==-1) {
                        break;
                    }
                    if (first) {
                        undeclared = new IntHashSet(8);
                        declared = new IntHashSet(8);
                        declared.add(NamespaceConstant.XML_NAMESPACE_CODE);
                        first = false;
                    }
                    short uriCode = (short)(nslist[i] & 0xffff);
                    short prefixCode = (short)(nslist[i] >> 16);
                    if (uriCode == 0) {
                        // this is an undeclaration
                        undeclared.add(prefixCode);
                    } else {
                        if (!undeclared.contains(prefixCode)) {
                            declared.add(nslist[i]);
                            undeclared.add(prefixCode);
                        }
                    }
                }
            }
            node = node.getParent();
View Full Code Here

     * of element names included in the substitution group
     */

  public SubstitutionGroupTest(int head, int[] members) {
        //(used from XQuery compiled code)
        group = new IntHashSet(members.length);
        for (int i=0; i<members.length; i++) {
            group.add(members[i]);
        }
        this.head = head;
  }
View Full Code Here

     * A null value indicates that all names are permitted (i.e. that there are no constraints on the node name.
     * The default implementation returns null.
     */

    public IntHashSet getRequiredNodeNames() {
        IntHashSet s = new IntHashSet(1);
        s.add(fingerprint);
        return s;
    }
View Full Code Here

        }
    }

    private NamespaceCodeIterator(NodeInfo element) {
        this.element = element;
        undeclared = new IntHashSet(8);
        index = 0;
        localDeclarations = element.getDeclaredNamespaces(null);
    }
View Full Code Here

TOP

Related Classes of org.pdf4j.saxon.sort.IntHashSet$IntHashSetIterator

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.