Package EDU.purdue.jtb.common
Class Messages
- java.lang.Object
-
- EDU.purdue.jtb.common.Messages
-
public class Messages extends java.lang.Object
ClassMessages
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 Messages()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
errorCount()
static void
hardErr(java.lang.String s)
Prints on System.err a fatal error message and the stack trace.static void
hardErr(java.lang.String s, java.lang.Throwable t)
Prints on System.err a fatal error message and the stack trace.void
info(java.lang.String s)
Prints on System.out an information text.void
info(java.lang.String s, int lineNum, int colNum)
Prints on System.out an information text and its line number.int
infoCount()
void
printSummary()
Prints on System.err the number of informations, warnings and errorsvoid
resetCounts()
Resets to zero the number of errors and warnings.void
softErr(java.lang.String s)
Prints on System.err a soft (non fatal) error text.void
softErr(java.lang.String s, int lineNum, int colNum)
Prints on System.err a soft (non fatal) error text and its line number.void
warning(java.lang.String s)
Prints on System.err a warning text.void
warning(java.lang.String s, int lineNum, int colNum)
Prints on System.err a warning text and its line number.int
warningCount()
-
-
-
Method Detail
-
printSummary
public void printSummary()
Prints on System.err the number of informations, warnings and errors
-
info
public void info(java.lang.String s)
Prints on System.out an information text.- Parameters:
s
- - the information text
-
info
public void info(java.lang.String s, int lineNum, int colNum)
Prints on System.out an information text and its line number.- Parameters:
s
- - the information textlineNum
- - the information line numbercolNum
- - the information column number
-
warning
public void warning(java.lang.String s)
Prints on System.err a warning text.- Parameters:
s
- - the warning text
-
warning
public void warning(java.lang.String s, int lineNum, int colNum)
Prints on System.err a warning text and its line number.- Parameters:
s
- - the warning textlineNum
- - the warning line numbercolNum
- - the warning column number
-
softErr
public void softErr(java.lang.String s)
Prints on System.err a soft (non fatal) error text.- Parameters:
s
- - an error text
-
softErr
public void softErr(java.lang.String s, int lineNum, int colNum)
Prints on System.err a soft (non fatal) error text and its line number.- Parameters:
s
- - the error textlineNum
- - the error line numbercolNum
- - the error column number
-
hardErr
public static void hardErr(java.lang.String s)
Prints on System.err a fatal error message and the stack trace.- Parameters:
s
- - a message
-
hardErr
public static void hardErr(java.lang.String s, java.lang.Throwable t)
Prints on System.err a fatal error message and the stack trace.- Parameters:
s
- - a messaget
- - 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.
-
-