1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
35 // 1. m_lElem < m_lSize
36 // 2. die Elemente in m_Array wurden double-hashed erzeugt
42 unsigned long m_lSize
;
43 unsigned long m_lElem
;
45 double m_dMaxLoadFactor
;
49 unsigned long Hash(const char *cKey
) const;
50 unsigned long DHash(const char *cKey
, unsigned long lHash
) const;
51 unsigned long Probe(unsigned long lPos
) const;
53 HashItem
* FindPos(const char *cKey
) const;
55 double CalcLoadFactor() const;
58 friend class HashTableIterator
;
60 virtual void OnDeleteObject(void* pObject
);
62 void* GetObjectAt(unsigned long lPos
) const;
66 static double m_defMaxLoadFactor
;
67 static double m_defDefGrowFactor
;
74 double dMaxLoadFactor
= HashTable::m_defMaxLoadFactor
/* 0.8 */,
75 double dGrowFactor
= HashTable::m_defDefGrowFactor
/* 2.0 */
81 unsigned long GetSize() const { return m_lSize
; }
83 void* Find (const char *cKey
) const;
84 bool Insert (const char *cKey
, void* pObject
);
85 void* Delete (const char *cKey
);
88 // ADT hash table iterator
90 // Invariante: 0 <= m_lAt < m_aTable.GetCount()
92 class HashTableIterator
95 HashTable
const& m_aTable
;
97 void operator =(HashTableIterator
&); // not defined
99 void* FindValidObject(bool bForward
);
102 void* GetFirst(); // Interation _ohne_ Sortierung
108 HashTableIterator(HashTable
const&);
111 #endif // _HASHTBL_HXX
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */