edu.stanford.nlp.util.logging
Class RepeatedRecordHandler

java.lang.Object
  extended by edu.stanford.nlp.util.logging.LogRecordHandler
      extended by edu.stanford.nlp.util.logging.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

Nested Class Summary
static class RepeatedRecordHandler.ApproximateRepeatSemantics
          Judges two records to be equal if they come from the same place, and begin with the same string, modulo numbers
static class RepeatedRecordHandler.ExactRepeatSemantics
          Judges two records to be equal if they are from the same place, and have the same message
static interface RepeatedRecordHandler.RepeatSemantics
          Determines the semantics of what constitutes a repeated record
 
Field Summary
static RepeatedRecordHandler.ApproximateRepeatSemantics APPROXIMATE
           
static RepeatedRecordHandler.ExactRepeatSemantics EXACT
           
 
Fields inherited from class edu.stanford.nlp.util.logging.LogRecordHandler
EMPTY
 
Constructor Summary
RepeatedRecordHandler(RepeatedRecordHandler.RepeatSemantics repeatSemantics)
          Create a new repeated log message handler, using the given semantics for what constitutes a repeated record.
 
Method Summary
 List<Redwood.Record> handle(Redwood.Record record)
          Handle a log Record, either as a filter or by producing a side effect.
 List<Redwood.Record> signalEndTrack(int newDepth, long timeEnded)
          Signal the end of a track, i.e.
 List<Redwood.Record> signalShutdown()
          
 List<Redwood.Record> signalStartTrack(Redwood.Record signal)
          Signal the start of a track, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APPROXIMATE

public static RepeatedRecordHandler.ApproximateRepeatSemantics APPROXIMATE

EXACT

public static RepeatedRecordHandler.ExactRepeatSemantics EXACT
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.

signalShutdown

public List<Redwood.Record> signalShutdown()

Overrides:
signalShutdown in class LogRecordHandler


Stanford NLP Group