1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 */ 20 package org.apache.directory.mavibot.btree; 21 22 23 import java.io.IOException; 24 25 import org.apache.directory.mavibot.btree.exception.EndOfFileExceededException; 26 27 28 /** 29 * A Cursor is used to fetch elements in a BTree and is returned by the 30 * @see BTree#browse method. The cursor <strng>must</strong> be closed 31 * when the user is done with it. 32 * <p> 33 * 34 * @param <V> The type for the stored value 35 * 36 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 37 */ 38 public interface ValueCursor<V> extends Cursor<V> 39 { 40 /** 41 * Find the next key/value 42 * 43 * @return A Tuple containing the found key and value 44 * @throws IOException 45 * @throws EndOfFileExceededException 46 */ 47 V next() throws EndOfFileExceededException, IOException; 48 49 50 /** 51 * Find the previous key/value 52 * 53 * @return A Tuple containing the found key and value 54 * @throws IOException 55 * @throws EndOfFileExceededException 56 */ 57 V prev() throws EndOfFileExceededException, IOException; 58 59 60 /** 61 * @return The number of elements stored in the cursor 62 */ 63 int size(); 64 }