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.server.xdbm; 21 22 23 import org.apache.directory.server.core.cursor.Cursor; 24 25 26 /** 27 * A Cursor introducing new advance methods designed to reduce some 28 * inefficiencies encountered when scanning over Tuples. 29 * 30 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 31 * @version $$Rev$$ 32 */ 33 public interface TupleCursor<K,V> extends Cursor<Tuple<K,V>> 34 { 35 /** 36 * An alternative to calling before(Tuple) which often may require 37 * wrapping a key in a newly created Tuple object that may be unnecessary. 38 * This method behaves just like before(Tuple) except it advances to just 39 * before the first value of the key. 40 * 41 * @param key the key to advance just before 42 * @throws Exception if there are faults peforming this operation 43 */ 44 void beforeKey( K key ) throws Exception; 45 46 47 /** 48 * An alternative to calling after(Tuple) which often may require 49 * wrapping a key in a newly created Tuple object that may be unnecessary. 50 * This method behaves just like after(Tuple) except it advances to just 51 * after the last value of the key. 52 * 53 * @param key the key to advance just after the last value 54 * @throws Exception if there are faults peforming this operation 55 */ 56 void afterKey( K key ) throws Exception; 57 58 59 /** 60 * An alternative to calling before(Tuple) which often may require 61 * wrapping a key and a value in a newly created Tuple object that may be 62 * unnecessary. This method behaves just like before(Tuple) except it 63 * advances to just before the value of the key which may still be of the 64 * same key. This method will not be supported if duplicate keys are not 65 * supported. In this case an UnsupportedOperationException will be 66 * thrown. 67 * 68 * @param key the key of the value to advance just before 69 * @param value the value to advance just before 70 * @throws UnsupportedOperationException if duplicate keys not supporrted 71 * @throws Exception if there are faults peforming this operation 72 */ 73 void beforeValue( K key, V value ) throws Exception; 74 75 76 /** 77 * An alternative to calling after(Tuple) which often may require 78 * wrapping a key and a value in a newly created Tuple object that may be 79 * unnecessary. This method behaves just like after(Tuple) except it 80 * advances to just after the value with the specified key. This method 81 * will not be supported if duplicate keys are not supported. In this 82 * case an UnsupportedOperationException will be thrown. 83 * 84 * @param key the key of the value to advance just after 85 * @param value the value to advance just after 86 * @throws UnsupportedOperationException if duplicate keys not supporrted 87 * @throws Exception if there are faults peforming this operation 88 */ 89 void afterValue( K key, V value ) throws Exception; 90 }