//
-// Open Service Platform
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
#include <FBaseComparerT.h>
#include <FBaseFloat.h>
-
namespace Tizen { namespace Base { namespace Collection
{
* The %HashMapT class provides a template-based collection of associated keys and values
* that are organized based on the hash code of the key.
* It contains unique keys and each key maps to one single value.
- * The key and value cannot be a null reference. Several methods in the %HashMapT class need assignment (=) operators of KeyType and ValueType.
+ * The key and value cannot be a @c null reference. Several methods in the %HashMapT class need the assignment (=) operators of the KeyType and the ValueType.
* @n
* For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/hashmap_multihashmap.htm">HashMap and MultiHashMap</a>.
*
* @since 2.0
*
* @return An error code
- * @param[in] capacity The initial capacity
- * @param[in] loadFactor The maximum ratio of elements to buckets
+ * @param[in] capacity The initial capacity
+ * @param[in] loadFactor The maximum ratio of elements to buckets
* @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG A specified input parameter is invalid, or
- * the @c capacity or the @c loadFactor is negative.
+ * @exception E_INVALID_ARG Either of the following conditions has occurred:
+ * - A specified input parameter is invalid.
+ * - The specified @c capacity or the specified @c loadFactor is negative.
* @remarks To work properly, the key type must be of a primitive number type.
* @see HashMapT()
*/
}
/**
- * Initializes this instance of %HashMapT by copying the elements of a specified map.
+ * Initializes this instance of %HashMapT by copying the elements of the specified @c map.
*
* @since 2.0
*
* @return An error code
- * @param[in] map The map to copy
- * @param[in] loadFactor The maximum ratio of elements to buckets
+ * @param[in] map The map to copy
+ * @param[in] loadFactor The maximum ratio of elements to buckets
* @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG A specified input parameter is invalid, or
- * the @c loadFactor is negative.
- * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation, or
- * the @c map is modified during the operation of this method.
+ * @exception E_INVALID_ARG Either of the following conditions has occurred:
+ * - A specified input parameter is invalid.
+ * - The specified @c loadFactor is negative.
+ * @exception E_INVALID_OPERATION Either of the following conditions has occurred:
+ * - The current state of the instance prohibits the execution of the specified operation.
+ * - The specified @c map is modified during the operation of this method.
* @see HashMapT()
*/
result Construct(const IMapT< KeyType, ValueType >& map, float loadFactor = 0.75)
}
/**
- * Initializes this instance of an empty %HashMapT class, with the specified initial capacity, load factor, hash code provider, and comparer.
+ * Initializes this instance of the empty %HashMapT, with the specified initial capacity, load factor, hash code provider, and comparer.
*
* @since 2.0
*
* @return An error code
- * @param[in] capacity The initial capacity @n
- * If it is @c 0, the default capacity (16) is used.
- * @param[in] loadFactor The maximum ratio of the elements to buckets @n
- * If it is @c 0, the default load factor (0.75) is used.
- * @param[in] provider An instance of the IHashCodeProviderT-derived class that supplies the hash codes
- * for all keys in this map
- * @param[in] comparer An instance of the IComparerT-derived class to use when comparing keys
+ * @param[in] capacity The initial capacity @n
+ * If it is @c 0, the default capacity (16) is used.
+ * @param[in] loadFactor The maximum ratio of the elements to buckets @n
+ * If it is @c 0, the default load factor (0.75) is used.
+ * @param[in] provider An instance of the IHashCodeProviderT-derived class that supplies the hash codes
+ * for all the keys in this map
+ * @param[in] comparer An instance of the IComparerT-derived class to use when comparing the keys
* @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
- * - A specified input parameter is invalid. @n
- * - The specified @c capacity is negative. @n
- * - The @c loadFactor is negative.
- * @remarks The instances of hash code provider and comparer will not be deallocated later from this map.
+ * @exception E_INVALID_ARG Either of the following conditions has occurred:
+ * - A specified input parameter is invalid.
+ * - The specified @c capacity is negative.
+ * - The specified @c loadFactor is negative.
+ * @remarks The instances of the hash code provider and the comparer are not deallocated later from this map.
* @see HashMapT()
*/
result Construct(int capacity, float loadFactor, const IHashCodeProviderT< KeyType >& provider,
}
/**
- * Initializes this instance of %HashMapT by copying the elements of a specified map,
- * with a specified load factor, hash code provider, and comparer.
+ * Initializes this instance of %HashMapT by copying the elements of the specified @c map,
+ * with the specified load factor, hash code provider, and comparer.
*
* @since 2.0
*
* @return An error code
- * @param[in] map The map to copy
- * @param[in] loadFactor The maximum ratio of elements to buckets @n
- * If it is @c 0, the default load factor (0.75) is used.
- * @param[in] provider An instance of the IHashCodeProviderT-derived class that supplies the hash codes
- * for all keys in this map
- * @param[in] comparer An instance of the IComparerT-derived class to use when comparing keys
+ * @param[in] map The map to copy
+ * @param[in] loadFactor The maximum ratio of elements to buckets @n
+ * If it is @c 0, the default load factor (0.75) is used.
+ * @param[in] provider An instance of the IHashCodeProviderT-derived class that supplies the hash codes
+ * for all the keys in this map
+ * @param[in] comparer An instance of the IComparerT-derived class to use when comparing the keys
* @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
- * - A specified input parameter is invalid. @n
- * - The @c loadFactor is negative. @n
- * - The @c provider is a @c null or the @c comparer is a @c null.
- * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation, or
- * the @c map is modified during the operation of this method.
- * @remarks The instances of hash code provider and comparer will not be deallocated later from this map.
+ * @exception E_INVALID_ARG Either of the following conditions has occurred:
+ * - A specified input parameter is invalid.
+ * - The specified @c loadFactor is negative.
+ * - Either the specified @c provider or the specified @c comparer is @c null.
+ * @exception E_INVALID_OPERATION Either of the following conditions has occurred:
+ * - The current state of the instance prohibits the execution of the specified operation.
+ * - The specified @c map is modified during the operation of this method.
+ * @remarks The instances of the hash code provider and the comparer are not deallocated later from this map.
* @see HashMapT()
*/
result Construct(const IMapT< KeyType, ValueType >& map, float loadFactor, const IHashCodeProviderT< KeyType >& provider,
}
/**
- * Adds the specified key-value pair to a map.
+ * Adds the specified key-value pair to the map.
*
* @since 2.0
*
* @return An error code
- * @param[in] key The key of the value to add
- * @param[in] value The value to add
+ * @param[in] key The key of the value to add
+ * @param[in] value The value to add
* @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG A specified input parameter is invalid, or
- * the comparer has failed to compare the keys.
+ * @exception E_INVALID_ARG Either of the following conditions has occurred:
+ * - A specified input parameter is invalid.
+ * - The comparer has failed to compare the keys.
* @exception E_OBJ_ALREADY_EXIST The specified @c key already exists.
* @see Remove()
*/
}
/**
- * Gets the elements of a map in an instance of the IMapEnumeratorT-derived class.
+ * Gets the elements of the map through an instance of the IMapEnumeratorT-derived class.
*
* @since 2.0
*
- * @return An instance of the IMapEnumeratorT-derived class if successful, @n
+ * @return An instance of the IMapEnumeratorT-derived class, @n
* else @c null if an exception occurs
* @exception E_SUCCESS The method is successful.
* @exception E_OUT_OF_MEMORY The memory is insufficient.
}
/**
- * Gets the elements of a map in an instance of the IMapEnumeratorT class.
+ * Gets the elements of the map through an instance of the IMapEnumeratorT class.
*
* @since 2.0
*
- * @return An instance of the IMapEnumeratorT class if successful, @n
+ * @return An instance of the IMapEnumeratorT class, @n
* else @c null if an exception occurs
* @exception E_SUCCESS The method is successful.
* @exception E_OUT_OF_MEMORY The memory is insufficient.
}
/**
- * Gets the value associated with a specified key.
+ * Gets the value associated with the specified @c key.
*
* @since 2.0
*
* @return The value associated with the key, @n
* else @c null if an exception occurs
- * @param[in] key The key to locate
- * @param[out] value The value associated with the key
+ * @param[in] key The key to locate
+ * @param[out] value The value associated with the @c key
* @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG A specified input parameter is invalid, or
- * The comparer has failed to compare the keys.
- * @exception E_OBJ_NOT_FOUND The specified @c key is not found in the map.
+ * @exception E_INVALID_ARG Either of the following conditions has occurred:
+ * - A specified input parameter is invalid.
+ * - The comparer has failed to compare the keys.
+ * @exception E_OBJ_NOT_FOUND The specified @c key has not been found in the map.
* @see SetValue()
*/
virtual result GetValue(const KeyType& key, ValueType& value) const
}
/**
- * Gets the value associated with a specified key.
+ * Gets the value associated with the specified @c key.
*
* @since 2.0
*
* @return The value associated with the key, @n
* else @c null if an exception occurs
- * @param[in] key The key to locate
- * @param[out] value The value associated with the key
+ * @param[in] key The key to locate
+ * @param[out] value The value associated with the @c key
* @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG A specified input parameter is invalid, or
- * the comparer has failed to compare the keys.
- * @exception E_OBJ_NOT_FOUND The specified @c key is not found in the map.
+ * @exception E_INVALID_ARG Either of the following conditions has occurred:
+ * - A specified input parameter is invalid.
+ * - The comparer has failed to compare the keys.
+ * @exception E_OBJ_NOT_FOUND The specified @c key has not been found in the map.
* @see SetValue()
*/
virtual result GetValue(const KeyType& key, ValueType& value)
}
/**
- * Gets a list of all the keys in a map.
+ * Gets the list of all the keys in the map.
*
* @since 2.0
*
- * @return A pointer to an IListT object containing all the keys in the map, @n
+ * @return A pointer to the IListT object that contains all the keys in the map, @n
* else @c null if an exception occurs
* @exception E_SUCCESS The method is successful.
* @exception E_OUT_OF_MEMORY The memory is insufficient.
- * @remarks The order of the keys is the same as the corresponding values in the IListT interface returned by the GetValuesN() method.
- * @remarks The specific error code can be accessed using the GetLastResult() method.
+ * @remarks
+ * - The order of the keys is the same as the corresponding values in the IListT interface returned by the GetValuesN() method.
+ * - The specific error code can be accessed using the GetLastResult() method.
* @see GetValuesN()
*/
virtual IListT< KeyType >* GetKeysN(void) const
}
/**
- * Gets all the values in a map.
+ * Gets all the values in the map.
*
* @since 2.0
*
- * @return A pointer to an IListT object containing all the values in the map, @n
+ * @return A pointer to the IListT object that contains all the values in the map, @n
* else @c null if an exception occurs
* @exception E_SUCCESS The method is successful.
* @exception E_OUT_OF_MEMORY The memory is insufficient.
}
/**
- * Removes the value associated with a specified key.
+ * Removes the value associated to the specified @c key.
*
* @since 2.0
*
* @return An error code
- * @param[in] key The key to remove
+ * @param[in] key The key to remove
* @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG The specified input parameter is invalid, or
- * the comparer has failed to compare the keys.
- * @exception E_OBJ_NOT_FOUND The specified @c key is not found in the map.
+ * @exception E_INVALID_ARG Either of the following conditions has occurred:
+ * - The specified input parameter is invalid.
+ * - The comparer has failed to compare the keys.
+ * @exception E_OBJ_NOT_FOUND The specified @c key has not been found in the map.
* @see Add()
*/
virtual result Remove(const KeyType& key)
}
/**
- * Removes all key-value pairs in the map.
+ * Removes all the key-value pairs in the map.
*
* @since 2.0
*/
}
/**
- * Replaces the value associated with a specified key with a new value.
+ * Replaces the value associated with the specified @c key with the specified new @c value.
*
* @since 2.0
*
* @return An error code
- * @param[in] key The key for which the value is to replace
- * @param[in] value The new value to replace
+ * @param[in] key The key whose value is replaced
+ * @param[in] value The new value to replace
* @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG A specified input parameter is invalid, or
- * the comparer has failed to compare the keys.
- * @exception E_OBJ_NOT_FOUND The specified @c key is not found in the map.
+ * @exception E_INVALID_ARG Either of the following conditions has occurred:
+ * - A specified input parameter is invalid.
+ * - The comparer has failed to compare the keys.
+ * @exception E_OBJ_NOT_FOUND The specified @c key has not been found in the map.
* @remarks Use the Add() method to add a new key-value pair.
- * @see Add()
* @see GetValue()
*/
virtual result SetValue(const KeyType& key, const ValueType& value)
}
/**
- * Gets the number of pairs currently stored in a map.
+ * Gets the number of pairs currently stored in the map.
*
* @since 2.0
*
}
/**
- * Checks whether a map contains the specified key.
+ * Checks whether the map contains the specified @c key.
*
* @since 2.0
*
* @return An error code
- * @param[in] key The key to locate
- * @param[out] out Set to @c true if the map contains the specified key, @n
- * else @c false
+ * @param[in] key The key to locate
+ * @param[out] out Set to @c true if the map contains the specified @c key, @n
+ * else @c false
* @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG A specified input parameter is invalid, or
- * the comparer has failed to compare the keys.
+ * @exception E_INVALID_ARG Either of the following conditions has occurred:
+ * - A specified input parameter is invalid.
+ * - The comparer has failed to compare the keys.
* @see ContainsValue()
*/
virtual result ContainsKey(const KeyType& key, bool& out) const
}
/**
- * Checks whether a map contains the specified value.
+ * Checks whether the map contains the specified @c value.
*
* @since 2.0
*
- * @return @c true if the map contains the specified value, @n
+ * @return @c true if the map contains the specified @c value, @n
* else @c false
* @param[in] value The value to locate
*
}
/**
- * Compares two instances of the %HashMapT class.
+ * Compares two instances of %HashMapT.
*
* @since 2.0
*
* @return @c true if the two instances match, @n
* else @c false
* @param[in] obj The object to compare with the current instance
- * @remarks This method returns @c true if and only if the two instances contain the same number of elements and all the elements of each other.
+ * @remarks This method returns @c true if and only if the two instances contain the same number of elements and all the elements are present in both of them.
*/
virtual bool Equals(const Object& obj) const
{
* @since 2.0
*
* @return The hash value of the current instance
- * @remarks The two Tizen::Base::Object::Equals() instances must return the same hash value. For better performance, @n
- * the used hash function must generate a random distribution for all inputs.
+ * @remarks The two Tizen::Base::Object::Equals() instances must return the same hash value. @n
+ * For better performance, the used hash function must generate a random distribution for all the inputs.
*/
virtual int GetHashCode(void) const
{
HashMapT< KeyType, ValueType >& operator =(const HashMapT< KeyType, ValueType >& map);
/**
- * Copies all the pairs from a specified map to this map.
+ * Copies all the pairs from a specified @c map to this map.
*
* @return An error code
- * @param[in] map The map to copy
+ * @param[in] map The map to copy
* @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.@n
+ * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
* The @c map is modified during the operation of this method.
*/
result AddAll(const IMapT< KeyType, ValueType >& map)
}
/**
- * Gets the hash value for a specified object.
+ * Gets the hash value for the specified object.
*
* @return The hash value for the specified object
* @param[in] obj The object to get hash value
* @param[in] k The key to include in this entry
* @param[in] v The value to include in this entry
* @param[in] next A pointer to the next entry
- * @param[in] h A hash value of the key
+ * @param[in] h The hash value of the key
*/
__HashMapEntryT(const KeyType& k, const ValueType& v, __HashMapEntryT< KeyType, ValueType >* next, int h)
: key(k)
* @since 2.0
*
* @return An error code
- * @param[out] obj The current object
+ * @param[out] obj The current object
* @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
- * This enumerator is currently positioned before the first element or
- * past the last element or the map is modified after this enumerator is created.
+ * @exception E_INVALID_OPERATION Either of the following conditions has occurred:
+ * - The current state of the instance prohibits the execution of the specified operation.
+ * - This enumerator is currently positioned before the first element or past the last element.
+ * - The map is modified after this enumerator is created.
*/
virtual result GetCurrent(MapEntryT< KeyType, ValueType >& obj) const
{
}
/**
- * Moves this enumerator to the next elements of the map.
- * When this enumerator is first created, or when the Reset() method is called, or when the MoveNext() method is first called, the enumerator positions itself to the first element in the map.
+ * Moves this enumerator to the next element of the map.
+ * When this enumerator is first created, or when the Reset() method is called, or when the %MoveNext() method is first called, the enumerator positions itself to the first element in the map.
*
* @since 2.0
*
* @return An error code
* @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation, or
- * the map is modified after this enumerator is created.
+ * @exception E_INVALID_OPERATION Either of the following conditions has occurred:
+ * - The current state of the instance prohibits the execution of the specified operation.
+ * - The map is modified after this enumerator is created.
* @exception E_OUT_OF_RANGE The enumerator has passed the end of the map.
- * @see Reset()
*/
virtual result MoveNext(void)
{
}
/**
- * Positions the enumerator before the first element in a map.
+ * Positions the enumerator before the first element in the map.
*
* @since 2.0
*
* @return An error code
* @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation, or
- * the map is modified after this enumerator is created.
+ * @exception E_INVALID_OPERATION Either of the following conditions has occurred:
+ * - The current state of the instance prohibits the execution of the specified operation.
+ * - The map is modified after this enumerator is created.
*/
virtual result Reset(void)
{
}
/**
- * Gets the current key in a map.
+ * Gets the current key in the map.
*
* @since 2.0
*
* @return An error code
- * @param[out] key The current key
+ * @param[out] key The current key
* @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
- * This enumerator is currently positioned before the first element or
- * past the last element or the map is modified after this enumerator is created.
+ * @exception E_INVALID_OPERATION Either of the following conditions has occurred:
+ * - The current state of the instance prohibits the execution of the specified operation.
+ * - This enumerator is currently positioned before the first element or past the last element.
+ * - The map is modified after this enumerator is created.
*/
virtual result GetKey(KeyType& key) const
{
}
/**
- * Gets the current value in a map.
+ * Gets the current value in the map.
*
* @since 2.0
*
* @return An error code
- * @param[out] value The current value
+ * @param[out] value The current value
* @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
- * This enumerator is currently positioned before the first element or
- * past the last element or the map is modified after the enumerator is created.
+ * @exception E_INVALID_OPERATION Either of the following conditions has occurred:
+ * - The current state of the instance prohibits the execution of the specified operation.
+ * - This enumerator is currently positioned before the first element or past the last element
+ * - The map is modified after the enumerator is created.
*/
virtual result GetValue(ValueType& value) const
{