Class Messages

java.lang.Object
EDU.purdue.jtb.common.Messages

public class Messages extends Object
Class Messages handles messages (informations, warnings and fatal errors), printing a message to the user and handling it appropriately.

Class maintains state, and is not supposed to be run in parallel threads (on the same grammar).

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    static void
    Prints on System.err a fatal error message and the stack trace.
    static void
    Prints on System.err a fatal error message and the stack trace.
    void
    Prints on System.out an information text.
    void
    info(String s, int lineNum, int colNum)
    Prints on System.out an information text and its line number.
    int
     
    void
    Prints on System.err the number of informations, warnings and errors
    void
    Resets to zero the number of errors and warnings.
    void
    Prints on System.err a soft (non fatal) error text.
    void
    softErr(String s, int lineNum, int colNum)
    Prints on System.err a soft (non fatal) error text and its line number.
    void
    Prints on System.err a warning text.
    void
    warning(String s, int lineNum, int colNum)
    Prints on System.err a warning text and its line number.
    int
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Messages

      public Messages()
  • Method Details

    • printSummary

      public void printSummary()
      Prints on System.err the number of informations, warnings and errors
    • info

      public void info(String s)
      Prints on System.out an information text.
      Parameters:
      s - - the information text
    • info

      public void info(String s, int lineNum, int colNum)
      Prints on System.out an information text and its line number.
      Parameters:
      s - - the information text
      lineNum - - the information line number
      colNum - - the information column number
    • warning

      public void warning(String s)
      Prints on System.err a warning text.
      Parameters:
      s - - the warning text
    • warning

      public void warning(String s, int lineNum, int colNum)
      Prints on System.err a warning text and its line number.
      Parameters:
      s - - the warning text
      lineNum - - the warning line number
      colNum - - the warning column number
    • softErr

      public void softErr(String s)
      Prints on System.err a soft (non fatal) error text.
      Parameters:
      s - - an error text
    • softErr

      public void softErr(String s, int lineNum, int colNum)
      Prints on System.err a soft (non fatal) error text and its line number.
      Parameters:
      s - - the error text
      lineNum - - the error line number
      colNum - - the error column number
    • hardErr

      public static void hardErr(String s)
      Prints on System.err a fatal error message and the stack trace.
      Parameters:
      s - - a message
    • hardErr

      public static void hardErr(String s, Throwable t)
      Prints on System.err a fatal error message and the stack trace.
      Parameters:
      s - - a message
      t - - a Throwable
    • infoCount

      public int infoCount()
      Returns:
      the number of informations
    • warningCount

      public int warningCount()
      Returns:
      the number of warnings
    • errorCount

      public int errorCount()
      Returns:
      the number of errors
    • resetCounts

      public void resetCounts()
      Resets to zero the number of errors and warnings.