Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

Lamp::HashMap< HashKey, ValueType > Class Template Reference

ハッシュマップ More...

#include <HashMap.h>

List of all members.

Public Member Functions

 HashMap (int capacity=16, float loadFactor=0.75f)
 コンストラクタ

 ~HashMap ()
 デストラクタ

void cloneTo (HashMap *destination) const
 クローン

int getCount () const
 要素数の取得

bool isEmpty () const
 空かどうか

ValueType get (const HashKey &key) const
 要素の取得

int getCapacity () const
 容量の取得

float getLoadFactor () const
 負荷係数の取得

void toArray (ArrayList< HashData< HashKey, ValueType > > *arrayList) const
 配列の取得

bool put (HashKey key, ValueType value)
 要素の追加

ValueType remove (HashKey key)
 要素の削除

void clear ()
 クリア

void setCapacity (int capacity)
 容量の設定

void trim ()
 トリム

void debugPrint (bool detail)
 デバッグ用出力


Detailed Description

template<typename HashKey, typename ValueType>
class Lamp::HashMap< HashKey, ValueType >

ハッシュマップ

このクラスは継承しないで下さい。 HashKeyは以下の4つのメソッドを実装している必要があります。
HashKey();
HashKey& operator =(const HashKey& copy);
bool equals(const HashKey& compare) const;
u_int getHashCode() const;
ValueTypeは通常はポインタ型を指定して下さい。

Definition at line 46 of file HashMap.h.


Constructor & Destructor Documentation

template<typename HashKey, typename ValueType>
Lamp::HashMap< HashKey, ValueType >::HashMap int  capacity = 16,
float  loadFactor = 0.75f
[inline, explicit]
 

コンストラクタ

Parameters:
capacity 初期容量
loadFactor 負荷係数

Definition at line 74 of file HashMap.h.


Member Function Documentation

template<typename HashKey, typename ValueType>
void Lamp::HashMap< HashKey, ValueType >::cloneTo HashMap< HashKey, ValueType > *  destination  )  const [inline]
 

クローン

Parameters:
destination クローン先ハッシュマップ

Definition at line 93 of file HashMap.h.

template<typename HashKey, typename ValueType>
void Lamp::HashMap< HashKey, ValueType >::debugPrint bool  detail  )  [inline]
 

デバッグ用出力

Parameters:
detail 詳細出力

Definition at line 342 of file HashMap.h.

template<typename HashKey, typename ValueType>
ValueType Lamp::HashMap< HashKey, ValueType >::get const HashKey &  key  )  const [inline]
 

要素の取得

Parameters:
key 取得する要素のキー
Returns:
要素。該当するキーが無ければNULL。

Definition at line 129 of file HashMap.h.

template<typename HashKey, typename ValueType>
int Lamp::HashMap< HashKey, ValueType >::getCapacity  )  const [inline]
 

容量の取得

Returns:
容量

Definition at line 146 of file HashMap.h.

template<typename HashKey, typename ValueType>
int Lamp::HashMap< HashKey, ValueType >::getCount  )  const [inline]
 

要素数の取得

Returns:
要素数

Definition at line 116 of file HashMap.h.

Referenced by Lamp::HashMap< String, Picture * >::cloneTo().

template<typename HashKey, typename ValueType>
float Lamp::HashMap< HashKey, ValueType >::getLoadFactor  )  const [inline]
 

負荷係数の取得

Returns:
負荷係数

Definition at line 152 of file HashMap.h.

template<typename HashKey, typename ValueType>
bool Lamp::HashMap< HashKey, ValueType >::isEmpty  )  const [inline]
 

空かどうか

Returns:
空ならtrueを返す

Definition at line 122 of file HashMap.h.

template<typename HashKey, typename ValueType>
bool Lamp::HashMap< HashKey, ValueType >::put HashKey  key,
ValueType  value
[inline]
 

要素の追加

Parameters:
key ハッシュキー。同じキーは登録不可。
value 格納する値。NULLは不可。
Returns:
成功すればture、すでに同じ要素があればfalseを返し、値は追加されない。

Definition at line 184 of file HashMap.h.

Referenced by Lamp::HashMap< String, Picture * >::cloneTo(), and Lamp::HashMap< String, Picture * >::setCapacity().

template<typename HashKey, typename ValueType>
ValueType Lamp::HashMap< HashKey, ValueType >::remove HashKey  key  )  [inline]
 

要素の削除

Parameters:
key ハッシュキー
Returns:
削除された値。見つからなければNULL

Definition at line 228 of file HashMap.h.

template<typename HashKey, typename ValueType>
void Lamp::HashMap< HashKey, ValueType >::setCapacity int  capacity  )  [inline]
 

容量の設定

Parameters:
capacity 設定するキャパシティ

Definition at line 296 of file HashMap.h.

Referenced by Lamp::HashMap< String, Picture * >::cloneTo(), Lamp::HashMap< String, Picture * >::put(), and Lamp::HashMap< String, Picture * >::trim().

template<typename HashKey, typename ValueType>
void Lamp::HashMap< HashKey, ValueType >::toArray ArrayList< HashData< HashKey, ValueType > > *  arrayList  )  const [inline]
 

配列の取得

Parameters:
arrayList [out]データを格納するArrayList

Definition at line 158 of file HashMap.h.


The documentation for this class was generated from the following file:
Generated on Wed Mar 16 10:29:47 2005 for Lamp by doxygen 1.3.2