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

private static class Sorters.StatusComparatorextends Sorters.Sort
Orders torrents by their download state.
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Fixed id, the comparator is never serialized across versions.
      See Also:
  • Constructor Details

    • StatusComparator

      private StatusComparator(boolean rev, String lang)
      Creates the state comparator.
      Parameters:
      rev - true to reverse the order
      lang - the language whose collation to use
  • Method Details

    • compareIt

      public int compareIt(Snark l, Snark r)
      Description copied from class: Sorters.Sort
      Compare two torrents on the subclass's column, falling back to name order.
      Specified by:
      compareIt in class Sorters.Sort
      Parameters:
      l - the left-hand torrent to compare
      r - the right-hand torrent to compare
      Returns:
      negative, zero or positive as l sorts before, with or after r
    • comp

      static int comp(Snark l, Snark r)
      Compare two torrents by status, with ties broken by swarm size for idle, inactive and magnet states, otherwise by active peer count.
      Parameters:
      l - the first torrent
      r - the second torrent
      Returns:
      the order of the two torrents
    • getStatus

      static int getStatus(Snark snark)
      Gives the sort rank for a torrent's state.
      Parameters:
      snark - the torrent to rank
      Returns:
      its state rank
    • getStatusImpl

      private static int getStatusImpl(Snark snark)
      Computes the state rank, stopped torrents offset.
      Parameters:
      snark - the torrent to rank
      Returns:
      its state rank