Java Doc for FastComparator.java in  » Development » Javolution » javolution » util » 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 » Javolution » javolution.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javolution.util.FastComparator

FastComparator
abstract public class FastComparator implements Comparator,XMLSerializable(Code)

This class represents a comparator to be used for equality as well as for ordering; instances of this class provide a hashcode function consistent with equal (if two objects FastComparator.areEqualare equal , they have the same FastComparator.hashCodeOf hashcode ), equality with null values is supported.

FastComparator can be employed with FastMap (e.g. custom key comparators for identity maps, value retrieval using keys of a different class that the map keys) or with FastCollection classes.


author:
   Jean-Marie Dautelle
version:
   4.2, December 18, 2006

Inner Class :final static class Default extends FastComparator
Inner Class :final static class Direct extends FastComparator
Inner Class :final static class Rehash extends FastComparator
Inner Class :final static class StringComparator extends FastComparator
Inner Class :final static class Identity extends FastComparator
Inner Class :final static class Lexical extends FastComparator

Field Summary
final public static  FastComparatorDEFAULT
     Holds the default object comparator; rehash is performed if the system hash code (platform dependent) is not evenly distributed.
final public static  FastComparatorDIRECT
     Holds the direct object comparator; no rehash is performed. Two objects o1 and o2 are considered FastComparator.areEqual equal if and only if o1.equals(o2).
final public static  FastComparatorIDENTITY
     Holds the identity comparator; poorly distributed system hashcodes are rehashed.
final public static  FastComparatorLEXICAL
     Holds a lexicographic comparator for any CharSequence or String instances.
final public static  FastComparatorREHASH
     Holds the comparator for objects with uneven hash distribution; objects hashcodes are rehashed.
final public static  ConfigurableREHASH_SYSTEM_HASHCODE
     Indicates if the system hash code should be rehashed (see Javolution Configuration for details).
final public static  FastComparatorSTRING
     Holds a fast comparator for java.lang.String.
static  boolean_Rehash
    


Method Summary
abstract public  booleanareEqual(Object o1, Object o2)
     Indicates if the specified objects can be considered equal.
Parameters:
  o1 - the first object (or null).
Parameters:
  o2 - the second object (or null).
abstract public  intcompare(Object o1, Object o2)
     Compares the specified objects for order.
abstract public  inthashCodeOf(Object obj)
     Returns the hash code for the specified object (consistent with FastComparator.areEqual ).

Field Detail
DEFAULT
final public static FastComparator DEFAULT(Code)
Holds the default object comparator; rehash is performed if the system hash code (platform dependent) is not evenly distributed.
See Also:    * Javolution Configuration



DIRECT
final public static FastComparator DIRECT(Code)
Holds the direct object comparator; no rehash is performed. Two objects o1 and o2 are considered FastComparator.areEqual equal if and only if o1.equals(o2). The FastComparator.compare method throws ClassCastException if the specified objects are not Comparable .



IDENTITY
final public static FastComparator IDENTITY(Code)
Holds the identity comparator; poorly distributed system hashcodes are rehashed. Two objects o1 and o2 are considered FastComparator.areEqual equal if and only if (o1 == o2). The FastComparator.compare method throws ClassCastException if the specified objects are not Comparable .



LEXICAL
final public static FastComparator LEXICAL(Code)
Holds a lexicographic comparator for any CharSequence or String instances. Two objects are considered FastComparator.areEqual equal if and only if they represents the same character sequence). The hashcode is calculated using the following formula (same as for java.lang.String): s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]



REHASH
final public static FastComparator REHASH(Code)
Holds the comparator for objects with uneven hash distribution; objects hashcodes are rehashed. Two objects o1 and o2 are considered FastComparator.areEqual equal if and only if o1.equals(o2). The FastComparator.compare method throws ClassCastException if the specified objects are not Comparable .



REHASH_SYSTEM_HASHCODE
final public static Configurable REHASH_SYSTEM_HASHCODE(Code)
Indicates if the system hash code should be rehashed (see Javolution Configuration for details).



STRING
final public static FastComparator STRING(Code)
Holds a fast comparator for java.lang.String. Hashcodes are calculated by taking a sample of few characters instead of the whole string.



_Rehash
static boolean _Rehash(Code)





Method Detail
areEqual
abstract public boolean areEqual(Object o1, Object o2)(Code)
Indicates if the specified objects can be considered equal.
Parameters:
  o1 - the first object (or null).
Parameters:
  o2 - the second object (or null). true if both objects are considered equal;false otherwise.



compare
abstract public int compare(Object o1, Object o2)(Code)
Compares the specified objects for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
Parameters:
  o1 - the first object.
Parameters:
  o2 - the second object. a negative integer, zero, or a positive integer as the firstargument is less than, equal to, or greater than the second.
throws:
  NullPointerException - if any of the specified object is null.



hashCodeOf
abstract public int hashCodeOf(Object obj)(Code)
Returns the hash code for the specified object (consistent with FastComparator.areEqual ). Two objects considered FastComparator.areEqual equal have the same hash code.
Parameters:
  obj - the object to return the hashcode for. the hashcode for the specified object.
throws:
  NullPointerException - if the specified object is null.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

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