Java Doc for Hash.java in  » Development » FastUtil » it » unimi » dsi » fastutil » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Development » FastUtil » it.unimi.dsi.fastutil 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


it.unimi.dsi.fastutil.Hash

Hash
public interface Hash (Code)
Basic data for all hash-based classes.

The classes in fastutil are built around open-addressing hashing implemented via double hashing. Following Knuth's suggestions in the third volume of The Art of Computer Programming, we use for the table size a prime p such that p-2 is also prime. In this way hashing is implemented with modulo p, and secondary hashing with modulo p-2.

Entries in a table can be in three states: Hash.FREE , Hash.OCCUPIED or Hash.REMOVED . The naive handling of removed entries requires that you search for a free entry as if they were occupied. However, fastutil implements two useful optimizations, based on the following invariant:

Let i0, i1, &hellip, ip-1 be the permutation of the table indices induced by the key k, that is, i0 is the hash of k and the following indices are obtained by adding (modulo p) the secondary hash plus one. If there is a Hash.OCCUPIED entry with key k, its index in the sequence above comes before the indices of any Hash.REMOVED entries with key k.

When we search for the key k we scan the entries in the sequence i0, i1, &hellip, ip-1 and stop when k is found, when we finished the sequence or when we find a Hash.FREE entry. Note that the correctness of this procedure it is not completely trivial. Indeed, when we stop at a Hash.REMOVED entry with key k we must rely on the invariant to be sure that no Hash.OCCUPIED entry with the same key can appear later. If we insert and remove frequently the same entries, this optimization can be very effective (note, however, that when using objects as keys or values deleted entries are set to a special fixed value to optimize garbage collection).

Moreover, during the probe we keep the index of the first Hash.REMOVED entry we meet. If we actually have to insert a new element, we use that entry if we can, thus avoiding to pollute another Hash.FREE entry. Since this position comes a fortiori before any Hash.REMOVED entries with the same key, we are also keeping the invariant true.


Inner Class :public interface Strategy

Field Summary
final public  intDEFAULT_GROWTH_FACTOR
     The default growth factor of a hash table.
final public  intDEFAULT_INITIAL_SIZE
     The initial default size of a hash table.
final public  floatDEFAULT_LOAD_FACTOR
     The default load factor of a hash table.
final public  floatFAST_LOAD_FACTOR
     The load factor for a (usually small) table that is meant to be particularly fast.
final public  byteFREE
     The state of a free hash table entry.
final public  byteOCCUPIED
     The state of a occupied hash table entry.
final public  intPRIMES
     A list of primes to be used as table sizes.
final public  byteREMOVED
     The state of a hash table entry freed by a deletion.
final public  floatVERY_FAST_LOAD_FACTOR
     The load factor for a (usually very small) table that is meant to be extremely fast.



Field Detail
DEFAULT_GROWTH_FACTOR
final public int DEFAULT_GROWTH_FACTOR(Code)
The default growth factor of a hash table.



DEFAULT_INITIAL_SIZE
final public int DEFAULT_INITIAL_SIZE(Code)
The initial default size of a hash table.



DEFAULT_LOAD_FACTOR
final public float DEFAULT_LOAD_FACTOR(Code)
The default load factor of a hash table.



FAST_LOAD_FACTOR
final public float FAST_LOAD_FACTOR(Code)
The load factor for a (usually small) table that is meant to be particularly fast.



FREE
final public byte FREE(Code)
The state of a free hash table entry.



OCCUPIED
final public byte OCCUPIED(Code)
The state of a occupied hash table entry.



PRIMES
final public int PRIMES(Code)
A list of primes to be used as table sizes. The i-th element is the largest prime p smaller than 2(i+28)/16 and such that p-2 is also prime (or 1, for the first few entries).



REMOVED
final public byte REMOVED(Code)
The state of a hash table entry freed by a deletion.



VERY_FAST_LOAD_FACTOR
final public float VERY_FAST_LOAD_FACTOR(Code)
The load factor for a (usually very small) table that is meant to be extremely fast.





www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.