Class ListeningEvent

java.lang.Object
yearreview.app.data.sources.audio.database.ListeningEvent
All Implemented Interfaces:
Comparable<ListeningEvent>

public class ListeningEvent extends Object implements Comparable<ListeningEvent>
An Event that represents a piece that was listened to at a certain time.
Author:
ColdStone37
  • Field Details

    • listenedTo

      public final AudioPiece listenedTo
      Piece that was listened to.
    • time

      public final Instant time
      Time the piece was listened to.
    • duration

      public final Duration duration
      Duration of listening.
  • Constructor Details

    • ListeningEvent

      public ListeningEvent(AudioPiece listenedTo, Instant time, Duration duration)
      Constructs a new ListeningEvent.
      Parameters:
      listenedTo - piece that was listened to
      time - time at which it was listened
      duration - duration of listening
  • Method Details

    • compareTo

      public int compareTo(ListeningEvent other)
      Compares two ListeningEvents by their time. Needed to implement the Comparable-interface.
      Specified by:
      compareTo in interface Comparable<ListeningEvent>
      Parameters:
      other - event to compare against
      Returns:
      negative value if this event is before the other event. Zero if the events were at the same time. Positive value otherwise