< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xpath/internal/NodeSet.java

Print this page


   1 /*
   2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
   3  * @LastModified: Nov 2017
   4  */
   5 /*
   6  * Licensed to the Apache Software Foundation (ASF) under one or more
   7  * contributor license agreements.  See the NOTICE file distributed with
   8  * this work for additional information regarding copyright ownership.
   9  * The ASF licenses this file to You under the Apache License, Version 2.0
  10  * (the "License"); you may not use this file except in compliance with
  11  * the License.  You may obtain a copy of the License at
  12  *
  13  *      http://www.apache.org/licenses/LICENSE-2.0
  14  *
  15  * Unless required by applicable law or agreed to in writing, software
  16  * distributed under the License is distributed on an "AS IS" BASIS,
  17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18  * See the License for the specific language governing permissions and
  19  * limitations under the License.
  20  */
  21 
  22 package com.sun.org.apache.xpath.internal;
  23 


  39  * act as a NodeVector or NodeList, it's required that
  40  * setShouldCacheNodes(true) be called before the first
  41  * nextNode() is called, in order that nodes can be added
  42  * as they are fetched.  Derived classes that implement iterators
  43  * must override runTo(int index), in order that they may
  44  * run the iteration to the given index. </p>
  45  *
  46  * <p>Note that we directly implement the DOM's NodeIterator
  47  * interface. We do not emulate all the behavior of the
  48  * standard NodeIterator. In particular, we do not guarantee
  49  * to present a "live view" of the document ... but in XSLT,
  50  * the source document should never be mutated, so this should
  51  * never be an issue.</p>
  52  *
  53  * <p>Thought: Should NodeSet really implement NodeList and NodeIterator,
  54  * or should there be specific subclasses of it which do so? The
  55  * advantage of doing it all here is that all NodeSets will respond
  56  * to the same calls; the disadvantage is that some of them may return
  57  * less-than-enlightening results when you do so.</p>
  58  * @xsl.usage advanced

  59  */
  60 public class NodeSet
  61         implements NodeList, NodeIterator, Cloneable, ContextNodeList
  62 {
  63 
  64   /**
  65    * Create an empty nodelist.
  66    */
  67   public NodeSet()
  68   {
  69     m_blocksize = 32;
  70     m_mapSize = 0;
  71   }
  72 
  73   /**
  74    * Create an empty, using the given block size.
  75    *
  76    * @param blocksize Size of blocks to allocate
  77    */
  78   public NodeSet(int blocksize)


   1 /*
   2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.

   3  */
   4 /*
   5  * Licensed to the Apache Software Foundation (ASF) under one or more
   6  * contributor license agreements.  See the NOTICE file distributed with
   7  * this work for additional information regarding copyright ownership.
   8  * The ASF licenses this file to You under the Apache License, Version 2.0
   9  * (the "License"); you may not use this file except in compliance with
  10  * the License.  You may obtain a copy of the License at
  11  *
  12  *      http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 
  21 package com.sun.org.apache.xpath.internal;
  22 


  38  * act as a NodeVector or NodeList, it's required that
  39  * setShouldCacheNodes(true) be called before the first
  40  * nextNode() is called, in order that nodes can be added
  41  * as they are fetched.  Derived classes that implement iterators
  42  * must override runTo(int index), in order that they may
  43  * run the iteration to the given index. </p>
  44  *
  45  * <p>Note that we directly implement the DOM's NodeIterator
  46  * interface. We do not emulate all the behavior of the
  47  * standard NodeIterator. In particular, we do not guarantee
  48  * to present a "live view" of the document ... but in XSLT,
  49  * the source document should never be mutated, so this should
  50  * never be an issue.</p>
  51  *
  52  * <p>Thought: Should NodeSet really implement NodeList and NodeIterator,
  53  * or should there be specific subclasses of it which do so? The
  54  * advantage of doing it all here is that all NodeSets will respond
  55  * to the same calls; the disadvantage is that some of them may return
  56  * less-than-enlightening results when you do so.</p>
  57  * @xsl.usage advanced
  58  * @LastModified: Nov 2017
  59  */
  60 public class NodeSet
  61         implements NodeList, NodeIterator, Cloneable, ContextNodeList
  62 {
  63 
  64   /**
  65    * Create an empty nodelist.
  66    */
  67   public NodeSet()
  68   {
  69     m_blocksize = 32;
  70     m_mapSize = 0;
  71   }
  72 
  73   /**
  74    * Create an empty, using the given block size.
  75    *
  76    * @param blocksize Size of blocks to allocate
  77    */
  78   public NodeSet(int blocksize)


< prev index next >