edu.stanford.nlp.util.logging
Class VisibilityHandler

java.lang.Object
  extended by edu.stanford.nlp.util.logging.LogRecordHandler
      extended by edu.stanford.nlp.util.logging.VisibilityHandler

public class VisibilityHandler
extends LogRecordHandler

A filter for selecting which channels are visible. This class behaves as an "or" filter; that is, if any of the filters are considered valid, it allows the Record to proceed to the next handler.

Author:
Gabor Angeli (angeli at cs.stanford)

Field Summary
 
Fields inherited from class edu.stanford.nlp.util.logging.LogRecordHandler
EMPTY
 
Constructor Summary
VisibilityHandler()
           
 
Method Summary
 boolean alsoHide(Object filter)
          Show all the channels currently being printed, with the exception of this new one
 boolean alsoShow(Object filter)
          Show all the channels currently being printed, in addition to a new one
 List<Redwood.Record> handle(Redwood.Record record)
          Handle a log Record, either as a filter or by producing a side effect.
 void hideAll()
          Show none of the channels
 void showAll()
          Show all of the channels.
 List<Redwood.Record> signalEndTrack(int newDepth, long timeOfEnd)
          Signal the end of a track, i.e.
 List<Redwood.Record> signalStartTrack(Redwood.Record signal)
          Signal the start of a track, i.e.
 
Methods inherited from class edu.stanford.nlp.util.logging.LogRecordHandler
signalShutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VisibilityHandler

public VisibilityHandler()
Method Detail

showAll

public void showAll()
Show all of the channels.


hideAll

public void hideAll()
Show none of the channels


alsoShow

public boolean alsoShow(Object filter)
Show all the channels currently being printed, in addition to a new one

Parameters:
filter - The channel to also show
Returns:
true if this channel was already being shown.

alsoHide

public boolean alsoHide(Object filter)
Show all the channels currently being printed, with the exception of this new one

Parameters:
filter - The channel to also hide
Returns:
true if this channel was already being hidden.

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 timeOfEnd)
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.


Stanford NLP Group