Changeset 564 in dev for trunk/ab5.0/jenga


Ignore:
Timestamp:
May 5, 2008, 2:17:58 PM (16 years ago)
Author:
dai_9181
Message:

IsExistIsExistDuplicationKeyName
・キー名ではなく、インスタンスそのものの重複を発見するためのIsExistメソッドを実装。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/jenga/include/common/Hashmap.h

    r520 r564  
    8686    }
    8787
    88     bool IsExist( const std::string &keyName ) const
     88    bool IsExistDuplicationKeyName( const std::string &keyName ) const
    8989    {
    9090        int key = GetHash( keyName.c_str() );
    9191
    9292        if(hashArray[key]){
    93             T *temp = hashArray[key];
     93            const T *temp = hashArray[key];
    9494            while( true ){
    9595                if( temp->IsDuplication( keyName ) )
     96                {
     97                    // 重複している
     98                    return true;
     99                }
     100
     101                if( temp->GetChainNext() == NULL )
     102                {
     103                    break;
     104                }
     105                temp = temp->GetChainNext();
     106            }
     107        }
     108
     109        return false;
     110    }
     111
     112    bool IsExist( const T* value ) const
     113    {
     114        int key = GetHash( value->GetKeyName().c_str() );
     115
     116        if(hashArray[key]){
     117            const T *temp = hashArray[key];
     118            while( true ){
     119                if( temp->IsDuplication( value ) )
    96120                {
    97121                    // 重複している
Note: See TracChangeset for help on using the changeset viewer.