src/java.xml/share/classes/com/sun/org/apache/xpath/internal/objects/XNodeSet.java
changeset 47359 e1a6c0168741
parent 47216 71c04702a3d5
child 48409 5ab69533994b
equal deleted inserted replaced
47358:d07d5f7cab35 47359:e1a6c0168741
     1 /*
     1 /*
     2  * reserved comment block
     2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT REMOVE OR ALTER!
     3  * @LastModified: Oct 2017
     4  */
     4  */
     5 /*
     5 /*
     6  * Licensed to the Apache Software Foundation (ASF) under one or more
     6  * Licensed to the Apache Software Foundation (ASF) under one or more
     7  * contributor license agreements.  See the NOTICE file distributed with
     7  * contributor license agreements.  See the NOTICE file distributed with
     8  * this work for additional information regarding copyright ownership.
     8  * this work for additional information regarding copyright ownership.
    25 import com.sun.org.apache.xml.internal.dtm.DTMIterator;
    25 import com.sun.org.apache.xml.internal.dtm.DTMIterator;
    26 import com.sun.org.apache.xml.internal.dtm.DTMManager;
    26 import com.sun.org.apache.xml.internal.dtm.DTMManager;
    27 import com.sun.org.apache.xml.internal.utils.XMLString;
    27 import com.sun.org.apache.xml.internal.utils.XMLString;
    28 import com.sun.org.apache.xpath.internal.NodeSetDTM;
    28 import com.sun.org.apache.xpath.internal.NodeSetDTM;
    29 import com.sun.org.apache.xpath.internal.axes.NodeSequence;
    29 import com.sun.org.apache.xpath.internal.axes.NodeSequence;
    30 
    30 import java.util.ArrayList;
       
    31 import java.util.List;
    31 import org.w3c.dom.NodeList;
    32 import org.w3c.dom.NodeList;
    32 import org.w3c.dom.traversal.NodeIterator;
    33 import org.w3c.dom.traversal.NodeIterator;
    33 
    34 
    34 /**
    35 /**
    35  * This class represents an XPath nodeset object, and is capable of
    36  * This class represents an XPath nodeset object, and is capable of
   493       // foo; the latter is true if and only if all nodes in $x have
   494       // foo; the latter is true if and only if all nodes in $x have
   494       // the string-value foo.
   495       // the string-value foo.
   495       DTMIterator list1 = iterRaw();
   496       DTMIterator list1 = iterRaw();
   496       DTMIterator list2 = ((XNodeSet) obj2).iterRaw();
   497       DTMIterator list2 = ((XNodeSet) obj2).iterRaw();
   497       int node1;
   498       int node1;
   498       java.util.Vector node2Strings = null;
   499       List<XMLString> node2Strings = null;
   499 
   500 
   500       while (DTM.NULL != (node1 = list1.nextNode()))
   501       while (DTM.NULL != (node1 = list1.nextNode()))
   501       {
   502       {
   502         XMLString s1 = getStringFromNode(node1);
   503         XMLString s1 = getStringFromNode(node1);
   503 
   504 
   515 
   516 
   516               break;
   517               break;
   517             }
   518             }
   518 
   519 
   519             if (null == node2Strings)
   520             if (null == node2Strings)
   520               node2Strings = new java.util.Vector();
   521               node2Strings = new ArrayList<>();
   521 
   522 
   522             node2Strings.addElement(s2);
   523             node2Strings.add(s2);
   523           }
   524           }
   524         }
   525         }
   525         else
   526         else
   526         {
   527         {
   527           int n = node2Strings.size();
   528           int n = node2Strings.size();
   528 
   529 
   529           for (int i = 0; i < n; i++)
   530           for (int i = 0; i < n; i++)
   530           {
   531           {
   531             if (comparator.compareStrings(s1, (XMLString)node2Strings.elementAt(i)))
   532             if (comparator.compareStrings(s1, node2Strings.get(i)))
   532             {
   533             {
   533               result = true;
   534               result = true;
   534 
   535 
   535               break;
   536               break;
   536             }
   537             }