1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
34 // 1. m_lElem < m_lSize
35 // 2. die Elemente in m_Array wurden double-hashed erzeugt
41 unsigned long m_lSize
;
42 unsigned long m_lElem
;
44 double m_dMaxLoadFactor
;
48 unsigned long Hash(const char *cKey
) const;
49 unsigned long DHash(const char *cKey
, unsigned long lHash
) const;
50 unsigned long Probe(unsigned long lPos
) const;
52 HashItem
* FindPos(const char *cKey
) const;
54 double CalcLoadFactor() const;
57 friend class HashTableIterator
;
59 virtual void OnDeleteObject(void* pObject
);
61 void* GetObjectAt(unsigned long lPos
) const;
65 static double m_defMaxLoadFactor
;
66 static double m_defDefGrowFactor
;
73 double dMaxLoadFactor
= HashTable::m_defMaxLoadFactor
/* 0.8 */,
74 double dGrowFactor
= HashTable::m_defDefGrowFactor
/* 2.0 */
80 unsigned long GetSize() const { return m_lSize
; }
82 void* Find (const char *cKey
) const;
83 bool Insert (const char *cKey
, void* pObject
);
84 void* Delete (const char *cKey
);
87 // ADT hash table iterator
89 // Invariante: 0 <= m_lAt < m_aTable.GetCount()
91 class HashTableIterator
94 HashTable
const& m_aTable
;
96 void operator =(HashTableIterator
&); // not defined
98 void* FindValidObject(bool bForward
);
101 void* GetFirst(); // Interation _ohne_ Sortierung
107 HashTableIterator(HashTable
const&);
110 #endif // _HASHTBL_HXX