Class RepeatedRecordHandler


  • public class RepeatedRecordHandler
    extends LogRecordHandler
    Filters repeated messages and replaces them with the number of times they were logged.
    Author:
    David McClosky,, Gabor Angeli (angeli at cs.stanford): approximate record equality, repeated tracks squashed
    • Constructor Detail

      • RepeatedRecordHandler

        public RepeatedRecordHandler​(RepeatedRecordHandler.RepeatSemantics repeatSemantics)
        Create a new repeated log message handler, using the given semantics for what constitutes a repeated record.
        Parameters:
        repeatSemantics - The semantics for what constitutes a repeated record
    • Method Detail

      • handle

        public List<Redwood.Record> handle​(Redwood.Record record)
        Handle a log Record, either as a filter or by producing a side effect.
        Specified by:
        handle in class LogRecordHandler
        Parameters:
        record - The log record to handle
        Returns:
        a (possibly empty) list of records to be sent on in the pipeline
      • signalStartTrack

        public List<Redwood.Record> signalStartTrack​(Redwood.Record signal)
        Signal the start of a track, i.e. that we have descended a level deeper.
        Overrides:
        signalStartTrack in class LogRecordHandler
        Parameters:
        signal - A record corresponding to the information in the track header. The depth in this object is the old log depth.
        Returns:
        A list of records to pass down the pipeline, not including the startTrack() signal. The returned records are passed to handle(), not startTrack(), and are sent before the startTrack() signal.
      • signalEndTrack

        public List<Redwood.Record> signalEndTrack​(int newDepth,
                                                   long timeEnded)
        Signal the end of a track, i.e. that we have popped up to a higher level.
        Overrides:
        signalEndTrack in class LogRecordHandler
        Parameters:
        newDepth - The new depth; that is, the current depth - 1.
        Returns:
        A list of records to pass down the pipeline. The returned records are passed to handle(), not endTrack(). and are sent before the startTrack() signal.