com.sun.org.apache.xalan.internal.xsltc.util.IntegerArray Java Examples

The following examples show how to use com.sun.org.apache.xalan.internal.xsltc.util.IntegerArray. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KeyIndex.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * <p>Given a context node and the second argument to the XSLT
 * <code>key</code> function, checks whether the context node is in the
 * set of nodes that results from that reference to the <code>key</code>
 * function.  This is used in the implementation of key patterns.</p>
 * <p>This particular {@link KeyIndex} object is the result evaluating the
 * first argument to the <code>key</code> function, so it's not taken into
 * any further account.</p>
 *
 * @param node The context node
 * @param value The second argument to the <code>key</code> function
 * @return <code>1</code> if and only if the context node is in the set of
 *         nodes returned by the reference to the <code>key</code> function;
 *         <code>0</code>, otherwise
 */
public int containsKey(int node, Object value) {
    int rootHandle = _dom.getAxisIterator(Axis.ROOT)
                             .setStartNode(node).next();

    // Get the mapping table for the document containing the context node
    Map<String,IntegerArray> index =
                _rootToIndexMap.get(new Integer(rootHandle));

    // Check whether the context node is present in the set of nodes
    // returned by the key function
    if (index != null) {
        final IntegerArray nodes = index.get(value);
        return (nodes != null && nodes.indexOf(node) >= 0) ? 1 : 0;
    }

    // The particular key name identifies no nodes in this document
    return 0;
}
 
Example #2
Source File: KeyIndex.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * <p>Given a context node and the second argument to the XSLT
 * <code>key</code> function, checks whether the context node is in the
 * set of nodes that results from that reference to the <code>key</code>
 * function.  This is used in the implementation of key patterns.</p>
 * <p>This particular {@link KeyIndex} object is the result evaluating the
 * first argument to the <code>key</code> function, so it's not taken into
 * any further account.</p>
 *
 * @param node The context node
 * @param value The second argument to the <code>key</code> function
 * @return <code>1</code> if and only if the context node is in the set of
 *         nodes returned by the reference to the <code>key</code> function;
 *         <code>0</code>, otherwise
 */
public int containsKey(int node, Object value) {
    int rootHandle = _dom.getAxisIterator(Axis.ROOT)
                             .setStartNode(node).next();

    // Get the mapping table for the document containing the context node
    Hashtable index =
                (Hashtable) _rootToIndexMap.get(new Integer(rootHandle));

    // Check whether the context node is present in the set of nodes
    // returned by the key function
    if (index != null) {
        final IntegerArray nodes = (IntegerArray) index.get(value);
        return (nodes != null && nodes.indexOf(node) >= 0) ? 1 : 0;
    }

    // The particular key name identifies no nodes in this document
    return 0;
}
 
Example #3
Source File: KeyIndex.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * <p>Given a context node and the second argument to the XSLT
 * <code>key</code> function, checks whether the context node is in the
 * set of nodes that results from that reference to the <code>key</code>
 * function.  This is used in the implementation of key patterns.</p>
 * <p>This particular {@link KeyIndex} object is the result evaluating the
 * first argument to the <code>key</code> function, so it's not taken into
 * any further account.</p>
 *
 * @param node The context node
 * @param value The second argument to the <code>key</code> function
 * @return <code>1</code> if and only if the context node is in the set of
 *         nodes returned by the reference to the <code>key</code> function;
 *         <code>0</code>, otherwise
 */
public int containsKey(int node, Object value) {
    int rootHandle = _dom.getAxisIterator(Axis.ROOT)
                             .setStartNode(node).next();

    // Get the mapping table for the document containing the context node
    Map<String,IntegerArray> index =
                _rootToIndexMap.get(rootHandle);

    // Check whether the context node is present in the set of nodes
    // returned by the key function
    if (index != null) {
        final IntegerArray nodes = index.get(value);
        return (nodes != null && nodes.indexOf(node) >= 0) ? 1 : 0;
    }

    // The particular key name identifies no nodes in this document
    return 0;
}
 
Example #4
Source File: KeyIndex.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * <p>Given a context node and the second argument to the XSLT
 * <code>key</code> function, checks whether the context node is in the
 * set of nodes that results from that reference to the <code>key</code>
 * function.  This is used in the implementation of key patterns.</p>
 * <p>This particular {@link KeyIndex} object is the result evaluating the
 * first argument to the <code>key</code> function, so it's not taken into
 * any further account.</p>
 *
 * @param node The context node
 * @param value The second argument to the <code>key</code> function
 * @return <code>1</code> if and only if the context node is in the set of
 *         nodes returned by the reference to the <code>key</code> function;
 *         <code>0</code>, otherwise
 */
public int containsKey(int node, Object value) {
    int rootHandle = _dom.getAxisIterator(Axis.ROOT)
                             .setStartNode(node).next();

    // Get the mapping table for the document containing the context node
    Map<String,IntegerArray> index =
                _rootToIndexMap.get(new Integer(rootHandle));

    // Check whether the context node is present in the set of nodes
    // returned by the key function
    if (index != null) {
        final IntegerArray nodes = index.get(value);
        return (nodes != null && nodes.indexOf(node) >= 0) ? 1 : 0;
    }

    // The particular key name identifies no nodes in this document
    return 0;
}
 
Example #5
Source File: KeyIndex.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * <p>Given a context node and the second argument to the XSLT
 * <code>key</code> function, checks whether the context node is in the
 * set of nodes that results from that reference to the <code>key</code>
 * function.  This is used in the implementation of key patterns.</p>
 * <p>This particular {@link KeyIndex} object is the result evaluating the
 * first argument to the <code>key</code> function, so it's not taken into
 * any further account.</p>
 *
 * @param node The context node
 * @param value The second argument to the <code>key</code> function
 * @return <code>1</code> if and only if the context node is in the set of
 *         nodes returned by the reference to the <code>key</code> function;
 *         <code>0</code>, otherwise
 */
public int containsKey(int node, Object value) {
    int rootHandle = _dom.getAxisIterator(Axis.ROOT)
                             .setStartNode(node).next();

    // Get the mapping table for the document containing the context node
    Hashtable index =
                (Hashtable) _rootToIndexMap.get(new Integer(rootHandle));

    // Check whether the context node is present in the set of nodes
    // returned by the key function
    if (index != null) {
        final IntegerArray nodes = (IntegerArray) index.get(value);
        return (nodes != null && nodes.indexOf(node) >= 0) ? 1 : 0;
    }

    // The particular key name identifies no nodes in this document
    return 0;
}
 
Example #6
Source File: KeyIndex.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * <p>Given a context node and the second argument to the XSLT
 * <code>key</code> function, checks whether the context node is in the
 * set of nodes that results from that reference to the <code>key</code>
 * function.  This is used in the implementation of key patterns.</p>
 * <p>This particular {@link KeyIndex} object is the result evaluating the
 * first argument to the <code>key</code> function, so it's not taken into
 * any further account.</p>
 *
 * @param node The context node
 * @param value The second argument to the <code>key</code> function
 * @return <code>1</code> if and only if the context node is in the set of
 *         nodes returned by the reference to the <code>key</code> function;
 *         <code>0</code>, otherwise
 */
public int containsKey(int node, Object value) {
    int rootHandle = _dom.getAxisIterator(Axis.ROOT)
                             .setStartNode(node).next();

    // Get the mapping table for the document containing the context node
    Map<String,IntegerArray> index =
                _rootToIndexMap.get(new Integer(rootHandle));

    // Check whether the context node is present in the set of nodes
    // returned by the key function
    if (index != null) {
        final IntegerArray nodes = index.get(value);
        return (nodes != null && nodes.indexOf(node) >= 0) ? 1 : 0;
    }

    // The particular key name identifies no nodes in this document
    return 0;
}
 
Example #7
Source File: KeyIndex.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * <p>Given a context node and the second argument to the XSLT
 * <code>key</code> function, checks whether the context node is in the
 * set of nodes that results from that reference to the <code>key</code>
 * function.  This is used in the implementation of key patterns.</p>
 * <p>This particular {@link KeyIndex} object is the result evaluating the
 * first argument to the <code>key</code> function, so it's not taken into
 * any further account.</p>
 *
 * @param node The context node
 * @param value The second argument to the <code>key</code> function
 * @return <code>1</code> if and only if the context node is in the set of
 *         nodes returned by the reference to the <code>key</code> function;
 *         <code>0</code>, otherwise
 */
public int containsKey(int node, Object value) {
    int rootHandle = _dom.getAxisIterator(Axis.ROOT)
                             .setStartNode(node).next();

    // Get the mapping table for the document containing the context node
    Map<String,IntegerArray> index =
                _rootToIndexMap.get(new Integer(rootHandle));

    // Check whether the context node is present in the set of nodes
    // returned by the key function
    if (index != null) {
        final IntegerArray nodes = index.get(value);
        return (nodes != null && nodes.indexOf(node) >= 0) ? 1 : 0;
    }

    // The particular key name identifies no nodes in this document
    return 0;
}
 
Example #8
Source File: KeyIndex.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * <p>Given a context node and the second argument to the XSLT
 * <code>key</code> function, checks whether the context node is in the
 * set of nodes that results from that reference to the <code>key</code>
 * function.  This is used in the implementation of key patterns.</p>
 * <p>This particular {@link KeyIndex} object is the result evaluating the
 * first argument to the <code>key</code> function, so it's not taken into
 * any further account.</p>
 *
 * @param node The context node
 * @param value The second argument to the <code>key</code> function
 * @return <code>1</code> if and only if the context node is in the set of
 *         nodes returned by the reference to the <code>key</code> function;
 *         <code>0</code>, otherwise
 */
public int containsKey(int node, Object value) {
    int rootHandle = _dom.getAxisIterator(Axis.ROOT)
                             .setStartNode(node).next();

    // Get the mapping table for the document containing the context node
    Map<String,IntegerArray> index =
                _rootToIndexMap.get(new Integer(rootHandle));

    // Check whether the context node is present in the set of nodes
    // returned by the key function
    if (index != null) {
        final IntegerArray nodes = index.get(value);
        return (nodes != null && nodes.indexOf(node) >= 0) ? 1 : 0;
    }

    // The particular key name identifies no nodes in this document
    return 0;
}
 
Example #9
Source File: KeyIndex.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * <p>Given a context node and the second argument to the XSLT
 * <code>key</code> function, checks whether the context node is in the
 * set of nodes that results from that reference to the <code>key</code>
 * function.  This is used in the implementation of key patterns.</p>
 * <p>This particular {@link KeyIndex} object is the result evaluating the
 * first argument to the <code>key</code> function, so it's not taken into
 * any further account.</p>
 *
 * @param node The context node
 * @param value The second argument to the <code>key</code> function
 * @return <code>1</code> if and only if the context node is in the set of
 *         nodes returned by the reference to the <code>key</code> function;
 *         <code>0</code>, otherwise
 */
public int containsKey(int node, Object value) {
    int rootHandle = _dom.getAxisIterator(Axis.ROOT)
                             .setStartNode(node).next();

    // Get the mapping table for the document containing the context node
    Map<String,IntegerArray> index =
                _rootToIndexMap.get(new Integer(rootHandle));

    // Check whether the context node is present in the set of nodes
    // returned by the key function
    if (index != null) {
        final IntegerArray nodes = index.get(value);
        return (nodes != null && nodes.indexOf(node) >= 0) ? 1 : 0;
    }

    // The particular key name identifies no nodes in this document
    return 0;
}
 
Example #10
Source File: CurrentNodeListIterator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisIterator cloneIterator() {
    try {
        final CurrentNodeListIterator clone =
            (CurrentNodeListIterator) super.clone();
        clone._nodes = (IntegerArray) _nodes.clone();
        clone._source = _source.cloneIterator();
        clone._isRestartable = false;
        return clone.reset();
    }
    catch (CloneNotSupportedException e) {
        BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
                                  e.toString());
        return null;
    }
}
 
Example #11
Source File: CurrentNodeListIterator.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public DTMAxisIterator cloneIterator() {
    try {
        final CurrentNodeListIterator clone =
            (CurrentNodeListIterator) super.clone();
        clone._nodes = (IntegerArray) _nodes.clone();
        clone._source = _source.cloneIterator();
        clone._isRestartable = false;
        return clone.reset();
    }
    catch (CloneNotSupportedException e) {
        BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
                                  e.toString());
        return null;
    }
}
 
Example #12
Source File: KeyIndex.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Given a context node and the argument to the XPath <code>id</code>
 * function, checks whether the context node is in the set of nodes that
 * results from that reference to the <code>id</code> function.  This is
 * used in the implementation of <code>id</code> patterns.
 *
 * @param node The context node
 * @param value The argument to the <code>id</code> function
 * @return <code>1</code> if the context node is in the set of nodes
 *         returned by the reference to the <code>id</code> function;
 *         <code>0</code>, otherwise
 */
public int containsID(int node, Object value) {
    final String string = (String)value;
    int rootHandle = _dom.getAxisIterator(Axis.ROOT)
                             .setStartNode(node).next();

    // Get the mapping table for the document containing the context node
    Map<String, IntegerArray> index =
        _rootToIndexMap.get(rootHandle);

    // Split argument to id function into XML whitespace separated tokens
    final StringTokenizer values = new StringTokenizer(string, " \n\t");

    while (values.hasMoreElements()) {
        final String token = (String) values.nextElement();
        IntegerArray nodes = null;

        if (index != null) {
            nodes = index.get(token);
        }

        // If input was from W3C DOM, use DOM's getElementById to do
        // the look-up.
        if (nodes == null && _enhancedDOM != null
            && _enhancedDOM.hasDOMSource()) {
            nodes = getDOMNodeById(token);
        }

        // Did we find the context node in the set of nodes?
        if (nodes != null && nodes.indexOf(node) >= 0) {
            return 1;
        }
    }

    // Didn't find the context node in the set of nodes returned by id
    return 0;
}
 
Example #13
Source File: CurrentNodeListIterator.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public DTMAxisIterator cloneIterator() {
    try {
        final CurrentNodeListIterator clone =
            (CurrentNodeListIterator) super.clone();
        clone._nodes = (IntegerArray) _nodes.clone();
        clone._source = _source.cloneIterator();
        clone._isRestartable = false;
        return clone.reset();
    }
    catch (CloneNotSupportedException e) {
        BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
                                  e.toString());
        return null;
    }
}
 
Example #14
Source File: CurrentNodeListIterator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisIterator cloneIterator() {
    try {
        final CurrentNodeListIterator clone =
            (CurrentNodeListIterator) super.clone();
        clone._nodes = (IntegerArray) _nodes.clone();
        clone._source = _source.cloneIterator();
        clone._isRestartable = false;
        return clone.reset();
    }
    catch (CloneNotSupportedException e) {
        BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
                                  e.toString());
        return null;
    }
}
 
Example #15
Source File: KeyIndex.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Given a context node and the argument to the XPath <code>id</code>
 * function, checks whether the context node is in the set of nodes that
 * results from that reference to the <code>id</code> function.  This is
 * used in the implementation of <code>id</code> patterns.
 *
 * @param node The context node
 * @param value The argument to the <code>id</code> function
 * @return <code>1</code> if the context node is in the set of nodes
 *         returned by the reference to the <code>id</code> function;
 *         <code>0</code>, otherwise
 */
public int containsID(int node, Object value) {
    final String string = (String)value;
    int rootHandle = _dom.getAxisIterator(Axis.ROOT)
                             .setStartNode(node).next();

    // Get the mapping table for the document containing the context node
    Map<String, IntegerArray> index =
        _rootToIndexMap.get(rootHandle);

    // Split argument to id function into XML whitespace separated tokens
    final StringTokenizer values = new StringTokenizer(string, " \n\t");

    while (values.hasMoreElements()) {
        final String token = (String) values.nextElement();
        IntegerArray nodes = null;

        if (index != null) {
            nodes = index.get(token);
        }

        // If input was from W3C DOM, use DOM's getElementById to do
        // the look-up.
        if (nodes == null && _enhancedDOM != null
            && _enhancedDOM.hasDOMSource()) {
            nodes = getDOMNodeById(token);
        }

        // Did we find the context node in the set of nodes?
        if (nodes != null && nodes.indexOf(node) >= 0) {
            return 1;
        }
    }

    // Didn't find the context node in the set of nodes returned by id
    return 0;
}
 
Example #16
Source File: DupFilterIterator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisIterator cloneIterator() {
    try {
        final DupFilterIterator clone =
            (DupFilterIterator) super.clone();
        clone._nodes = (IntegerArray) _nodes.clone();
        clone._source = _source.cloneIterator();
        clone._isRestartable = false;
        return clone.reset();
    }
    catch (CloneNotSupportedException e) {
        BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
                                  e.toString());
        return null;
    }
}
 
Example #17
Source File: CurrentNodeListIterator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisIterator cloneIterator() {
    try {
        final CurrentNodeListIterator clone =
            (CurrentNodeListIterator) super.clone();
        clone._nodes = (IntegerArray) _nodes.clone();
        clone._source = _source.cloneIterator();
        clone._isRestartable = false;
        return clone.reset();
    }
    catch (CloneNotSupportedException e) {
        BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
                                  e.toString());
        return null;
    }
}
 
Example #18
Source File: CurrentNodeListIterator.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public DTMAxisIterator cloneIterator() {
    try {
        final CurrentNodeListIterator clone =
            (CurrentNodeListIterator) super.clone();
        clone._nodes = (IntegerArray) _nodes.clone();
        clone._source = _source.cloneIterator();
        clone._isRestartable = false;
        return clone.reset();
    }
    catch (CloneNotSupportedException e) {
        BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
                                  e.toString());
        return null;
    }
}
 
Example #19
Source File: DupFilterIterator.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public DTMAxisIterator cloneIterator() {
    try {
        final DupFilterIterator clone =
            (DupFilterIterator) super.clone();
        clone._nodes = (IntegerArray) _nodes.clone();
        clone._source = _source.cloneIterator();
        clone._isRestartable = false;
        return clone.reset();
    }
    catch (CloneNotSupportedException e) {
        BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
                                  e.toString());
        return null;
    }
}
 
Example #20
Source File: KeyIndex.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Given a context node and the argument to the XPath <code>id</code>
 * function, checks whether the context node is in the set of nodes that
 * results from that reference to the <code>id</code> function.  This is
 * used in the implementation of <code>id</code> patterns.
 *
 * @param node The context node
 * @param value The argument to the <code>id</code> function
 * @return <code>1</code> if the context node is in the set of nodes
 *         returned by the reference to the <code>id</code> function;
 *         <code>0</code>, otherwise
 */
public int containsID(int node, Object value) {
    final String string = (String)value;
    int rootHandle = _dom.getAxisIterator(Axis.ROOT)
                             .setStartNode(node).next();

    // Get the mapping table for the document containing the context node
    Map<String, IntegerArray> index =
        _rootToIndexMap.get(rootHandle);

    // Split argument to id function into XML whitespace separated tokens
    final StringTokenizer values = new StringTokenizer(string, " \n\t");

    while (values.hasMoreElements()) {
        final String token = (String) values.nextElement();
        IntegerArray nodes = null;

        if (index != null) {
            nodes = index.get(token);
        }

        // If input was from W3C DOM, use DOM's getElementById to do
        // the look-up.
        if (nodes == null && _enhancedDOM != null
            && _enhancedDOM.hasDOMSource()) {
            nodes = getDOMNodeById(token);
        }

        // Did we find the context node in the set of nodes?
        if (nodes != null && nodes.indexOf(node) >= 0) {
            return 1;
        }
    }

    // Didn't find the context node in the set of nodes returned by id
    return 0;
}
 
Example #21
Source File: DupFilterIterator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisIterator cloneIterator() {
    try {
        final DupFilterIterator clone =
            (DupFilterIterator) super.clone();
        clone._nodes = (IntegerArray) _nodes.clone();
        clone._source = _source.cloneIterator();
        clone._isRestartable = false;
        return clone.reset();
    }
    catch (CloneNotSupportedException e) {
        BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
                                  e.toString());
        return null;
    }
}
 
Example #22
Source File: DupFilterIterator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisIterator cloneIterator() {
    try {
        final DupFilterIterator clone =
            (DupFilterIterator) super.clone();
        clone._nodes = (IntegerArray) _nodes.clone();
        clone._source = _source.cloneIterator();
        clone._isRestartable = false;
        return clone.reset();
    }
    catch (CloneNotSupportedException e) {
        BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
                                  e.toString());
        return null;
    }
}
 
Example #23
Source File: KeyIndex.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Given a context node and the argument to the XPath <code>id</code>
 * function, checks whether the context node is in the set of nodes that
 * results from that reference to the <code>id</code> function.  This is
 * used in the implementation of <code>id</code> patterns.
 *
 * @param node The context node
 * @param value The argument to the <code>id</code> function
 * @return <code>1</code> if the context node is in the set of nodes
 *         returned by the reference to the <code>id</code> function;
 *         <code>0</code>, otherwise
 */
public int containsID(int node, Object value) {
    final String string = (String)value;
    int rootHandle = _dom.getAxisIterator(Axis.ROOT)
                             .setStartNode(node).next();

    // Get the mapping table for the document containing the context node
    Map<String, IntegerArray> index =
        _rootToIndexMap.get(new Integer(rootHandle));

    // Split argument to id function into XML whitespace separated tokens
    final StringTokenizer values = new StringTokenizer(string, " \n\t");

    while (values.hasMoreElements()) {
        final String token = (String) values.nextElement();
        IntegerArray nodes = null;

        if (index != null) {
            nodes = index.get(token);
        }

        // If input was from W3C DOM, use DOM's getElementById to do
        // the look-up.
        if (nodes == null && _enhancedDOM != null
            && _enhancedDOM.hasDOMSource()) {
            nodes = getDOMNodeById(token);
        }

        // Did we find the context node in the set of nodes?
        if (nodes != null && nodes.indexOf(node) >= 0) {
            return 1;
        }
    }

    // Didn't find the context node in the set of nodes returned by id
    return 0;
}
 
Example #24
Source File: CurrentNodeListIterator.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisIterator cloneIterator() {
    try {
        final CurrentNodeListIterator clone =
            (CurrentNodeListIterator) super.clone();
        clone._nodes = (IntegerArray) _nodes.clone();
        clone._source = _source.cloneIterator();
        clone._isRestartable = false;
        return clone.reset();
    }
    catch (CloneNotSupportedException e) {
        BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
                                  e.toString());
        return null;
    }
}
 
Example #25
Source File: DupFilterIterator.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisIterator cloneIterator() {
    try {
        final DupFilterIterator clone =
            (DupFilterIterator) super.clone();
        clone._nodes = (IntegerArray) _nodes.clone();
        clone._source = _source.cloneIterator();
        clone._isRestartable = false;
        return clone.reset();
    }
    catch (CloneNotSupportedException e) {
        BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
                                  e.toString());
        return null;
    }
}
 
Example #26
Source File: KeyIndex.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Given a context node and the argument to the XPath <code>id</code>
 * function, checks whether the context node is in the set of nodes that
 * results from that reference to the <code>id</code> function.  This is
 * used in the implementation of <code>id</code> patterns.
 *
 * @param node The context node
 * @param value The argument to the <code>id</code> function
 * @return <code>1</code> if the context node is in the set of nodes
 *         returned by the reference to the <code>id</code> function;
 *         <code>0</code>, otherwise
 */
public int containsID(int node, Object value) {
    final String string = (String)value;
    int rootHandle = _dom.getAxisIterator(Axis.ROOT)
                             .setStartNode(node).next();

    // Get the mapping table for the document containing the context node
    Map<String, IntegerArray> index =
        _rootToIndexMap.get(rootHandle);

    // Split argument to id function into XML whitespace separated tokens
    final StringTokenizer values = new StringTokenizer(string, " \n\t");

    while (values.hasMoreElements()) {
        final String token = (String) values.nextElement();
        IntegerArray nodes = null;

        if (index != null) {
            nodes = index.get(token);
        }

        // If input was from W3C DOM, use DOM's getElementById to do
        // the look-up.
        if (nodes == null && _enhancedDOM != null
            && _enhancedDOM.hasDOMSource()) {
            nodes = getDOMNodeById(token);
        }

        // Did we find the context node in the set of nodes?
        if (nodes != null && nodes.indexOf(node) >= 0) {
            return 1;
        }
    }

    // Didn't find the context node in the set of nodes returned by id
    return 0;
}
 
Example #27
Source File: CurrentNodeListIterator.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisIterator cloneIterator() {
    try {
        final CurrentNodeListIterator clone =
            (CurrentNodeListIterator) super.clone();
        clone._nodes = (IntegerArray) _nodes.clone();
        clone._source = _source.cloneIterator();
        clone._isRestartable = false;
        return clone.reset();
    }
    catch (CloneNotSupportedException e) {
        BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
                                  e.toString());
        return null;
    }
}
 
Example #28
Source File: DupFilterIterator.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisIterator cloneIterator() {
    try {
        final DupFilterIterator clone =
            (DupFilterIterator) super.clone();
        clone._nodes = (IntegerArray) _nodes.clone();
        clone._source = _source.cloneIterator();
        clone._isRestartable = false;
        return clone.reset();
    }
    catch (CloneNotSupportedException e) {
        BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
                                  e.toString());
        return null;
    }
}
 
Example #29
Source File: CurrentNodeListIterator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisIterator cloneIterator() {
    try {
        final CurrentNodeListIterator clone =
            (CurrentNodeListIterator) super.clone();
        clone._nodes = (IntegerArray) _nodes.clone();
        clone._source = _source.cloneIterator();
        clone._isRestartable = false;
        return clone.reset();
    }
    catch (CloneNotSupportedException e) {
        BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
                                  e.toString());
        return null;
    }
}
 
Example #30
Source File: DupFilterIterator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisIterator cloneIterator() {
    try {
        final DupFilterIterator clone =
            (DupFilterIterator) super.clone();
        clone._nodes = (IntegerArray) _nodes.clone();
        clone._source = _source.cloneIterator();
        clone._isRestartable = false;
        return clone.reset();
    }
    catch (CloneNotSupportedException e) {
        BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
                                  e.toString());
        return null;
    }
}