/*
 * Jakelib2 - General purpose C++ library
 * Copyright (C) 2001 Florian Wolff  (florian@donuz.de)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * $Id: Dictionary.h,v 1.6 2002/09/08 15:16:29 florian Exp $
 */

#ifndef INCLUDE_JAKELIB2_UTIL_DICTIONARY_H
# define INCLUDE_JAKELIB2_UTIL_DICTIONARY_H

namespace jakelib {
  namespace util {
    class HashtableIterator;

    /**
     *
     * @class Dictionary
     * @version $Id: Dictionary.h,v 1.6 2002/09/08 15:16:29 florian Exp $
     * @author Florian 'Overflo' Wolff (florian@donuz.de)
     */
    class Dictionary : public jakelib::lang::Object
      {
      public:

	JAKELIB_DECLARE_CLASS(Dictionary);
    
	/**
	 * @brief Returns the number of keys in this dictionary.
	 *
	 * @return The number of keys in this dictionary.
	 */
	virtual int size() = 0;
  
	/**
	 * @brief Tests if this dictionary maps no keys to values.
	 *
	 * @return  <tt>true</tt> if this dictionary maps no keys to values;
	 *          <tt>false</tt> otherwise.
	 */
	virtual jboolean isEmpty() = 0;
    
	/**
	 * @brief Returns the value to which the specified key is mapped in this dictionary.
	 *
	 * @param key A key in the dictionary.
	 * @return The value to which the key is mapped in this dictionary; <tt>null</tt> if the key is not mapped to any value in this dictionary.
	 */
	virtual jakelib::lang::Object* get(jakelib::lang::Object* key) = 0;
    
	/**
	 * @brief Removes a specified key from the hash.
	 *
	 * @param key The key to be deleted
	 */
	virtual void remove(jakelib::lang::Object* key) = 0;
    
	/**
	 * @brief Maps the specified <TT>key</TT> to the specified 
	 * <TT>value</TT> in this dictionary. Neither the key nor the 
	 * value can be <TT>null</TT>.
	 *
	 * The value can be retrieved by calling the <TT>get</TT> method 
	 * with a key that is equal to the original key. 
	 *
	 * @param key The dictionary key.
	 * @param value The value.
	 * @exception NullPointerException If the key or value is <TT>NULL</TT>.
	 */
	virtual void put(jakelib::lang::Object* key, jakelib::lang::Object* value) = 0;
    
	/**
	 * @brief Deletes all items from hash.
	 */
	virtual void clear() = 0;
  
	/**
	 * @brief Returns an iterator over all keys in the dictionary.
	 *
	 * @return keys The iterator.
	 */
	virtual HashtableIterator* keys() = 0;
      };

  }
}
#endif

