Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.monte.media.imgseq
Class OSXCollator

    java.lang.Object
      java.text.Collator
          org.monte.media.imgseq.OSXCollator

All Implemented Interfaces:
  java.lang.Cloneable, java.util.Comparator<java.lang.Object>

    public class OSXCollator

extends java.text.Collator

The OSXCollator strives to match the collation rules used by the Mac OS X Finder and of Mac OS X file dialogs.

If we wanted to match the OS X collation rules exactly, we would have to implement the rules for all languages supported by Mac OS X and Java. To reduce the amount of work needed for implementing these rules, the OSXCollator changes the collation rules returned by java.text.Collator.getInstance() to do the following:

- Space characters are treated as primary collation differences
- Hyphen characters are treated as primary collation differences
- Sequence of digits (characters '0' through '9') is treated as a single collation object. The current implementation supports sequences of up to 999 characters length.

If java.text.Collator.getInstance() does not return an instance of java.text.RuleBasedCollator, then the returned collator is used, and only sequences of digits are changed to match the collation rules of Mac OS X.

Version:
  $Id: OSXCollator.java 134 2011-12-02 16:23:00Z werner $
Author:
  Werner Randelshofer

Field Summary

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

Constructor Summary
`OSXCollator()` Creates a new instance.
`OSXCollator(java.util.Locale locale)`

Method Summary
`int` | `compare(java.lang.String source, java.lang.String target)`
`boolean` | `equals(java.lang.Object o)`
`java.text.CollationKey` | `getCollationKey(java.lang.String source)`
`int` | `hashCode()`

Methods inherited from class java.text.Collator
`clone, compare, equals, getAvailableLocales, getDecomposition, getInstance, getInstance, getStrength, setDecomposition, setStrength`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### OSXCollator

    public OSXCollator()

  Creates a new instance.

### OSXCollator

    public OSXCollator(java.util.Locale locale)

Method Detail

### compare

    public int compare(java.lang.String source,
                       java.lang.String target)

  Specified by:
    `compare` in class `java.text.Collator`

### getCollationKey

    public java.text.CollationKey getCollationKey(java.lang.String source)

  Specified by:
    `getCollationKey` in class `java.text.Collator`

### equals

    public boolean equals(java.lang.Object o)

  Specified by:
    `equals` in interface `java.util.Comparator<java.lang.Object>`
  Overrides:
    `equals` in class `java.text.Collator`

### hashCode

    public int hashCode()

  Specified by:
    `hashCode` in class `java.text.Collator`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD