IOSCollator

public class IOSCollator extends Collator

A concrete implementation class for Collation for iOS. Although iOS uses ICU, its collation data is not available from any public APIs. This class implements collation by invoking the NSString localized comparison methods.

Inherited Constant Summary

Public Method Summary

int
compare(String string1, String string2)
Compares two strings to determine their relative order.
boolean
equals(Object obj)
Compares this instance with the specified object and indicates if they are equal.
CollationKey
getCollationKey(String string)
Returns a CollationKey for the specified string for this collator with the current decomposition rule and strength value.
int
getDecomposition()
Returns the decomposition rule for this collator.
int
getStrength()
Returns the strength value for this collator.
int
hashCode()
Returns an integer hash code for this object.
void
setDecomposition(int value)
Sets decomposition field, but is otherwise unused.
void
setStrength(int value)
Sets strength field, but is otherwise unused.

Inherited Method Summary

Public Methods

public int compare (String string1, String string2)

Compares two strings to determine their relative order.

Parameters
string1 the first string to compare.
string2 the second string to compare.
Returns
  • a negative value if string1 is less than string2, 0 if they are equal and a positive value if string1 is greater than string2.

public boolean equals (Object obj)

Compares this instance with the specified object and indicates if they are equal. In order to be equal, o must represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be reflexive, symmetric, and transitive. Also, no object reference other than null is equal to null.

The default implementation returns true only if this == o. See Writing a correct equals method if you intend implementing your own equals method.

The general contract for the equals and hashCode() methods is that if equals returns true for any two objects, then hashCode() must return the same value for these objects. This means that subclasses of Object usually override either both methods or neither of them.

Parameters
obj the object to compare this instance with.
Returns
  • true if the specified object is equal to this Object; false otherwise.

public CollationKey getCollationKey (String string)

Returns a CollationKey for the specified string for this collator with the current decomposition rule and strength value.

Parameters
string the source string that is converted into a collation key.
Returns
  • the collation key for string.

public int getDecomposition ()

Returns the decomposition rule for this collator.

Returns
  • the decomposition rule, either NO_DECOMPOSITION or CANONICAL_DECOMPOSITION. FULL_DECOMPOSITION is not supported.

public int getStrength ()

Returns the strength value for this collator.

Returns
  • the strength value, either PRIMARY, SECONDARY, TERTIARY or IDENTICAL.

public int hashCode ()

Returns an integer hash code for this object. By contract, any two objects for which equals(Object) returns true must return the same hash code value. This means that subclasses of Object usually override both methods or neither method.

Note that hash values must not change over time unless information used in equals comparisons also changes.

See Writing a correct hashCode method if you intend implementing your own hashCode method.

Returns
  • this object's hash code.

public void setDecomposition (int value)

Sets decomposition field, but is otherwise unused.

Parameters
value the decomposition rule, either NO_DECOMPOSITION or CANONICAL_DECOMPOSITION. FULL_DECOMPOSITION is not supported.

public void setStrength (int value)

Sets strength field, but is otherwise unused.

Parameters
value the strength value, either PRIMARY, SECONDARY, TERTIARY, or IDENTICAL.