java.lang.Object
org.klomp.snark.web.Sorters.TorrentNameComparator
All Implemented Interfaces:
Serializable, Comparator<Snark>
Enclosing class:
Sorters

private static class Sorters.TorrentNameComparatorextends Object implements Comparator<Snark>, Serializable
Sort alphabetically in current locale, ignore case, ignore leading articles such as "the" if the pattern is set by setPattern().
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Fixed id, the sorter is never serialized across versions.
      See Also:
    • _p

      private final Pattern _p
      Pattern extracting the name's sort key.
    • _c

      private final Collator _c
      Collator ordering the names for the language.
  • Constructor Details

    • TorrentNameComparator

      private TorrentNameComparator(String lang)
      Create the comparator for the language.
      Parameters:
      lang - may be null
  • Method Details

    • compare

      public int compare(Snark l, Snark r)
      Specified by:
      compare in interface Comparator<Snark>
    • comp

      public static int comp(Snark l, Snark r, Pattern p, Collator c)
      Compare two torrents by name.
      Parameters:
      l - the first torrent
      r - the second torrent
      p - may be null
      c - may be null
      Returns:
      the order of the two torrents