java.lang.Object
org.klomp.snark.web.I2PSnarkServlet.CommentsHeaderResult
Enclosing class:
I2PSnarkServlet

static class I2PSnarkServlet.CommentsHeaderResultextends Object
Snapshot read atomically from a torrent's comment set: the user's own rating, community rating count and average, and an iterator over the existing comments when any exist. Package-visible for testing.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) final double
    Community average rating, 0d when there are no ratings.
    (package private) final Iterator<Comment>
    Iterator over the existing comments, null when none are saved.
    (package private) final int
    The user's own rating, 0 when unrated or ratings are disabled.
    (package private) final int
    Number of ratings cast by the community, 0 when ratings are disabled.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CommentsHeaderResult(int myRating)
    Single-value result for the no-comment-set case.
    CommentsHeaderResult(int myRating, int ratingCount, double averageRating, Iterator<Comment> iter)
    Records the rating snapshot read from a torrent's comment set.
  • Method Summary

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • myRating

      final int myRating
      The user's own rating, 0 when unrated or ratings are disabled.
    • ratingCount

      final int ratingCount
      Number of ratings cast by the community, 0 when ratings are disabled.
    • averageRating

      final double averageRating
      Community average rating, 0d when there are no ratings.
    • iter

      final Iterator<Comment> iter
      Iterator over the existing comments, null when none are saved.
  • Constructor Details

    • CommentsHeaderResult

      CommentsHeaderResult(int myRating)
      Single-value result for the no-comment-set case.
      Parameters:
      myRating - the user's own rating (0 when none)
    • CommentsHeaderResult

      CommentsHeaderResult(int myRating, int ratingCount, double averageRating, Iterator<Comment> iter)
      Records the rating snapshot read from a torrent's comment set.
      Parameters:
      myRating - the user's own rating, 0 when unrated or ratings are disabled
      ratingCount - number of ratings cast by the community
      averageRating - community average rating, 0d when there are none
      iter - iterator over the existing comments, null when none are saved