001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *
010 *    http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License.
018 *
019 */
020package org.apache.directory.mavibot.btree;
021
022
023/**
024 * The Tuple class is used when we browse a btree, it will contain the results
025 * fetched from the btree.
026 * 
027 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
028 *
029 * @param <K> The type for the Key
030 * @param <V> The type for the stored value
031 */
032public class Tuple<K, V>
033{
034    /** The key */
035    private K key;
036
037    /** The value */
038    private V value;
039
040
041    /**
042     * Creates a Tuple with no content
043     */
044    public Tuple()
045    {
046    }
047
048
049    /**
050     * Creates a Tuple containing a key and its associated value.
051     * @param key The key
052     * @param value The associated value
053     */
054    public Tuple( K key, V value )
055    {
056        this.key = key;
057        this.value = value;
058    }
059
060
061    /**
062     * @return the key
063     */
064    public K getKey()
065    {
066        return key;
067    }
068
069
070    /**
071     * @param key the key to set
072     */
073    public void setKey( K key )
074    {
075        this.key = key;
076    }
077
078
079    /**
080     * @return the value
081     */
082    public V getValue()
083    {
084        return value;
085    }
086
087
088    /**
089     * @param value the value to set
090     */
091    public void setValue( V value )
092    {
093        this.value = value;
094    }
095
096
097    /**
098     * @see Object#toString()
099     */
100    public String toString()
101    {
102        return "<" + key + "," + value + ">";
103    }
104}