polyglot.util
Class AbstractErrorQueue

java.lang.Object
  extended by polyglot.util.AbstractErrorQueue
All Implemented Interfaces:
ErrorQueue
Direct Known Subclasses:
SilentErrorQueue, StdErrorQueue

public abstract class AbstractErrorQueue
extends java.lang.Object
implements ErrorQueue

A StdErrorQueue handles outputing error messages.


Field Summary
protected  int errorCount
           
protected  boolean flushed
           
protected  int limit
           
protected  java.lang.String name
           
 
Constructor Summary
AbstractErrorQueue(int limit, java.lang.String name)
           
 
Method Summary
protected abstract  void displayError(ErrorInfo error)
           
 void enqueue(ErrorInfo e)
           
 void enqueue(int type, java.lang.String message)
           
 void enqueue(int type, java.lang.String message, Position position)
           
 int errorCount()
           
 void flush()
          This method is called to flush the error queue.
 boolean hasErrors()
           
protected  void tooManyErrors(ErrorInfo lastError)
          This method is called when we have had too many errors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

flushed

protected boolean flushed

errorCount

protected int errorCount

limit

protected final int limit

name

protected final java.lang.String name
Constructor Detail

AbstractErrorQueue

public AbstractErrorQueue(int limit,
                          java.lang.String name)
Method Detail

enqueue

public final void enqueue(int type,
                          java.lang.String message)
Specified by:
enqueue in interface ErrorQueue

enqueue

public final void enqueue(int type,
                          java.lang.String message,
                          Position position)
Specified by:
enqueue in interface ErrorQueue

enqueue

public final void enqueue(ErrorInfo e)
Specified by:
enqueue in interface ErrorQueue

displayError

protected abstract void displayError(ErrorInfo error)

tooManyErrors

protected void tooManyErrors(ErrorInfo lastError)
This method is called when we have had too many errors. This method give subclasses the opportunity to output appropriate messages, or tidy up.

Parameters:
lastError - the last error that pushed us over the limit

flush

public void flush()
This method is called to flush the error queue. Subclasses may want to print summary information in this method.

Specified by:
flush in interface ErrorQueue

hasErrors

public final boolean hasErrors()
Specified by:
hasErrors in interface ErrorQueue

errorCount

public final int errorCount()
Specified by:
errorCount in interface ErrorQueue