Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


com.tangosol.util
Class CacheCollator

java.lang.Object
  extended by java.text.Collator
      extended by com.tangosol.util.CacheCollator

All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Comparator

public class CacheCollator
extends java.text.Collator
implements java.io.Serializable

Implements a collator which caches its keys.

Version:
1.00, 10/01/98
Author:
Cameron Purdy

Field Summary

 

Fields inherited from class java.text.Collator
CANONICAL_DECOMPOSITION, FULL_DECOMPOSITION, IDENTICAL, NO_DECOMPOSITION, PRIMARY, SECONDARY, TERTIARY

 

Constructor Summary
CacheCollator(java.text.Collator collator)
          Construct this collator to cache the results of another collator.

 

Method Summary
 java.lang.Object clone()
          Clone the caching collator.
 int compare(java.lang.String source, java.lang.String target)
          Compares the source string to the target string according to the collation rules for this Collator.
 boolean equals(java.lang.Object that)
          Compares the equality of two Collators.
protected  java.util.Map getCache()
           
 java.text.CollationKey getCollationKey(java.lang.String source)
          Transforms the String into a series of bits that can be compared bitwise to other CollationKeys.
 int getDecomposition()
          Get the decomposition mode of this Collator.
 int getStrength()
          Returns this Collator's strength property.
 int hashCode()
          Generates the hash code for this Collator.
 void setDecomposition(int decomposition)
          Set the decomposition mode of this Collator.
 void setStrength(int newStrength)
          Sets this Collator's strength property.

 

Methods inherited from class java.text.Collator
compare, equals, getAvailableLocales, getInstance, getInstance

 

Constructor Detail

CacheCollator

public CacheCollator(java.text.Collator collator)
Construct this collator to cache the results of another collator.
Parameters:
collator - the collator to delegate to

Method Detail

getStrength

public int getStrength()
Returns this Collator's strength property. The strength property determines the minimum level of difference considered significant during comparison.
Overrides:
getStrength in class java.text.Collator
Returns:
this Collator's current strength property.

setStrength

public void setStrength(int newStrength)
Sets this Collator's strength property. The strength property determines the minimum level of difference considered significant during comparison.
Overrides:
setStrength in class java.text.Collator
Parameters:
newStrength - the new strength value.
Throws:
java.lang.UnsupportedOperationException - always thrown

getDecomposition

public int getDecomposition()
Get the decomposition mode of this Collator. Decomposition mode determines how Unicode composed characters are handled. Adjusting decomposition mode allows the user to select between faster and more complete collation behavior.
Overrides:
getDecomposition in class java.text.Collator
Returns:
the decomposition mode

setDecomposition

public void setDecomposition(int decomposition)
Set the decomposition mode of this Collator. See getDecomposition for a description of decomposition mode.
Overrides:
setDecomposition in class java.text.Collator
Parameters:
decomposition - the new decomposition mode
Throws:
java.lang.UnsupportedOperationException - always thrown

compare

public int compare(java.lang.String source,
                   java.lang.String target)
Compares the source string to the target string according to the collation rules for this Collator. Returns an integer less than, equal to or greater than zero depending on whether the source String is less than, equal to or greater than the target string. See the Collator class description for an example of use.

For a one time comparison, this method has the best performance. If a given String will be involved in multiple comparisons, CollationKey.compareTo has the best performance. See the Collator class description for an example using CollationKeys.

Specified by:
compare in class java.text.Collator
Parameters:
source - the source string.
target - the target string.
Returns:
Returns an integer value. Value is less than zero if source is less than target, value is zero if source and target are equal, value is greater than zero if source is greater than target.

getCollationKey

public java.text.CollationKey getCollationKey(java.lang.String source)
Transforms the String into a series of bits that can be compared bitwise to other CollationKeys. CollationKeys provide better performance than Collator.compare when Strings are involved in multiple comparisons. See the Collator class description for an example using CollationKeys.
Specified by:
getCollationKey in class java.text.Collator
Parameters:
source - the string to be transformed into a collation key.
Returns:
the CollationKey for the given String based on this Collator's collation rules. If the source String is null, a null CollationKey is returned.

clone

public java.lang.Object clone()
Clone the caching collator.
Overrides:
clone in class java.text.Collator
Returns:
a clone of this object

equals

public boolean equals(java.lang.Object that)
Compares the equality of two Collators.
Specified by:
equals in interface java.util.Comparator
Overrides:
equals in class java.text.Collator
Parameters:
that - the Collator to be compared with this.
Returns:
true if this Collator is the same as that Collator; false otherwise.
See Also:
Object.equals(java.lang.Object), Object.hashCode()

hashCode

public int hashCode()
Generates the hash code for this Collator.
Specified by:
hashCode in class java.text.Collator
Returns:
the hashcode of the delegatee collator

getCache

protected java.util.Map getCache()
Returns:
the internal cache map

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.