java.lang.Object
i2p.susi.webmail.Sorters.SorterBase
All Implemented Interfaces:
Serializable, Comparator<String>
Direct Known Subclasses:
Sorters.DateSorter, Sorters.SenderSorter, Sorters.SizeSorter, Sorters.SubjectSorter, Sorters.ToSorter
Enclosing class:
Sorters

private abstract static class Sorters.SorterBaseextends Object implements Comparator<String>, Serializable
Base for the various sorters.
  • Field Details

    • mailCache

      private final MailCache mailCache
      Mail cache to fetch mail objects from.
  • Constructor Details

    • SorterBase

      protected SorterBase(MailCache mailCache)
      Mail cache for fetching mail objects to compare.
      Parameters:
      mailCache - the cache to retrieve Mail objects from
  • Method Details

    • compare

      public int compare(String arg0, String arg1)
      Compare two objects.
      Specified by:
      compare in interface Comparator<String>
    • compare

      protected abstract int compare(Mail a, Mail b)
      Compare two mail objects.
      Parameters:
      a - the mail on the left of the comparison
      b - the mail on the right of the comparison
      Returns:
      negative, zero or positive as the left mail sorts before or after the right
    • fallbackCompare

      private int fallbackCompare(Mail a, Mail b)
      Date-based fallback comparator.
      Parameters:
      a - the first mail to compare
      b - the second mail to compare
      Returns:
      negative, zero or positive as a's date sorts before or after b's