1 /* 2 * $Id: RangeIterator.java,v 1.2 2004/07/24 00:16:21 benjmestrallet Exp $ 3 * 4 * Copyright 2002-2004 Day Management AG, Switzerland. 5 * 6 * Licensed under the Day RI License, Version 2.0 (the "License"), 7 * as a reference implementation of the following specification: 8 * 9 * Content Repository API for Java Technology, revision 0.12 10 * <http://www.jcp.org/en/jsr/detail?id=170> 11 * 12 * You may not use this file except in compliance with the License. 13 * You may obtain a copy of the License files at 14 * 15 * http://www.day.com/content/en/licenses/day-ri-license-2.0 16 * http://www.apache.org/licenses/LICENSE-2.0 17 * 18 * Unless required by applicable law or agreed to in writing, software 19 * distributed under the License is distributed on an "AS IS" BASIS, 20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 * See the License for the specific language governing permissions and 22 * limitations under the License. 23 */ 24 package javax.jcr; 25 26 import java.util.Iterator; 27 28 /** 29 * Extends <code>Iterator</code> with the <code>skip</code>, <code>getSize</code> 30 * and <code>getPos</code> methods. The base interface of all type-specific 31 * iterators in the <code>javax.jcr</code> and its subpackages. 32 * 33 * @author Peeter Piegaze 34 * @author Stefan Guggisberg 35 */ 36 public interface RangeIterator extends Iterator { 37 38 /** 39 * Skip a number of elements in the iterator. 40 * 41 * @param skipNum the non-negative number of elements to skip 42 * @throws java.util.NoSuchElementException 43 * if skipped past the last element in the iterator. 44 */ 45 public void skip(int skipNum); 46 47 /** 48 * Returns the number of elements in the iterator. 49 * If this information is unavailable, returns -1. 50 * 51 * @return a long 52 */ 53 public long getSize(); 54 55 /** 56 * Returns the current position within the iterator. The number 57 * returned is the 0-based index of the next element in the iterator, 58 * i.e. the one that will be returned on the subsequent <code>next</code> call. 59 * <p/> 60 * Note that this method does not check if there is a next element, 61 * i.e. an empty iterator will always return 0. 62 * 63 * @return a long 64 */ 65 public long getPos(); 66 } 67