1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   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.xml.internal.dtm;
  23 
  24 /**
  25  * This class iterates over a single XPath Axis, and returns node handles.
  26  */
  27 public interface DTMAxisIterator extends Cloneable
  28 {
  29 
  30   /** Specifies the end of the iteration, and is the same as DTM.NULL.  */
  31   public static final int END = DTM.NULL;
  32 
  33   /**
  34    * Get the next node in the iteration.
  35    *
  36    * @return The next node handle in the iteration, or END.
  37    */
  38   public int next();
  39 
  40 
  41   /**
  42    * Resets the iterator to the last start node.
  43    *
  44    * @return A DTMAxisIterator, which may or may not be the same as this
  45    *         iterator.
  46    */
  47   public DTMAxisIterator reset();
  48 
  49   /**
  50    * @return the number of nodes in this iterator.  This may be an expensive
  51    * operation when called the first time.
  52    */
  53   public int getLast();
  54 
  55   /**
  56    * @return The position of the current node in the set, as defined by XPath.
  57    */
  58   public int getPosition();
  59 
  60   /**
  61    * Remembers the current node for the next call to gotoMark().
  62    */
  63   public void setMark();
  64 
  65   /**
  66    * Restores the current node remembered by setMark().
  67    */
  68   public void gotoMark();
  69 
  70   /**
  71    * Set start to END should 'close' the iterator,
  72    * i.e. subsequent call to next() should return END.
  73    *
  74    * @param node Sets the root of the iteration.
  75    *
  76    * @return A DTMAxisIterator set to the start of the iteration.
  77    */
  78   public DTMAxisIterator setStartNode(int node);
  79 
  80   /**
  81    * Get start to END should 'close' the iterator,
  82    * i.e. subsequent call to next() should return END.
  83    *
  84    * @return The root node of the iteration.
  85    */
  86   public int getStartNode();
  87 
  88   /**
  89    * @return true if this iterator has a reversed axis, else false.
  90    */
  91   public boolean isReverse();
  92 
  93   /**
  94    * @return a deep copy of this iterator. The clone should not be reset
  95    * from its current position.
  96    */
  97   public DTMAxisIterator cloneIterator();
  98 
  99   /**
 100    * Set if restartable.
 101    */
 102   public void setRestartable(boolean isRestartable);
 103 
 104   /**
 105    * Return the node at the given position.
 106    *
 107    * @param position The position
 108    * @return The node at the given position.
 109    */
 110   public int getNodeByPosition(int position);
 111 }