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 /** 24 * The Tuple class is used when we browse a btree, it will contain the results 25 * fetched from the btree. 26 * 27 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 28 * 29 * @param <K> The type for the Key 30 * @param <V> The type for the stored value 31 */ 32 public class Tuple<K, V> 33 { 34 /** The key */ 35 private K key; 36 37 /** The value */ 38 private V value; 39 40 41 /** 42 * Creates a Tuple with no content 43 */ 44 public Tuple() 45 { 46 } 47 48 49 /** 50 * Creates a Tuple containing a key and its associated value. 51 * @param key The key 52 * @param value The associated value 53 */ 54 public Tuple( K key, V value ) 55 { 56 this.key = key; 57 this.value = value; 58 } 59 60 61 /** 62 * @return the key 63 */ 64 public K getKey() 65 { 66 return key; 67 } 68 69 70 /** 71 * @param key the key to set 72 */ 73 public void setKey( K key ) 74 { 75 this.key = key; 76 } 77 78 79 /** 80 * @return the value 81 */ 82 public V getValue() 83 { 84 return value; 85 } 86 87 88 /** 89 * @param value the value to set 90 */ 91 public void setValue( V value ) 92 { 93 this.value = value; 94 } 95 96 97 /** 98 * @see Object#toString() 99 */ 100 public String toString() 101 { 102 return "<" + key + "," + value + ">"; 103 } 104 }