cox.jmatt.java.MathTools.util
Interface MathPrinter

All Known Implementing Classes:
BasicMathPrinter, MTApplet

public interface MathPrinter

This interface describes the mechanism by which the MathTools classes communicate with external applications. It provides a very basic logging framework, a general-purpose print method, and a generic processMathObject() method.

The logging framework is not intended to be a comprehensive logging package. Rather, it represents the minimum equipment needed to debug MathTools apps and to report error conditions within the MathTools classes themselves.

The mathPrintln() and processMathObject() methods provide a non-logging way to communicate with applications. mathPrintln() is designed to print messages outside the logging framework. The processMathObject() method is designed to provide a very generic way for a customized MathPrinter to process something defined by the application implementing it.

Operationally, a MathPrinter works in conjunction with CapCom. CapCom implements all MathPrinter methods (but NOT the interface itself!) and the MathTools classes that generate logging messages all report to CapCom. CapCom contains a method to set a global MathPrinter and, if one is set, all log, print and processMathObject() calls are directed to it. If no MathPrinter is set, CapCom silently ignores all such calls. Most of the classes in the demo package also utilize the Global Printer for their output, so adding them to other applications will require a Global Printer!


Field Summary
static byte LOG_DEBUG
          Debug is used to report internal conditions within MathTools classes.
static byte LOG_ERROR
          Error level represents a serious problem that may terminate program execution.
static byte LOG_INFO
          Info-level logging is for messages of interest but not necessarily a program-threatening nature.
 
Method Summary
 void mathLog(byte pLevel, java.lang.String pMesg, java.lang.Throwable pThr)
          This method provides a connection for MathTools to log errors and information.
 void mathPrintln(java.lang.String pMesg)
          Print a message to something that will be read either immediately or later.
 java.lang.Object processMathObject(java.lang.Object pData)
          This method provides a basic, generic extension point for custom MathPrinter implementations.
 

Field Detail

LOG_INFO

static final byte LOG_INFO
Info-level logging is for messages of interest but not necessarily a program-threatening nature.

See Also:
Constant Field Values

LOG_DEBUG

static final byte LOG_DEBUG
Debug is used to report internal conditions within MathTools classes. It is primarily intended for debugging applications.

See Also:
Constant Field Values

LOG_ERROR

static final byte LOG_ERROR
Error level represents a serious problem that may terminate program execution.

See Also:
Constant Field Values
Method Detail

mathLog

void mathLog(byte pLevel,
             java.lang.String pMesg,
             java.lang.Throwable pThr)
This method provides a connection for MathTools to log errors and information. What is done with this data is implementation-specific.

Parameters:
pLevel - One of the LOG_ levels defined above.
pMesg - A String message describing the event.
pThr - A Throwable generated by the event. May be null.

mathPrintln

void mathPrintln(java.lang.String pMesg)
Print a message to something that will be read either immediately or later.

Parameters:
pMesg - The String message to be printed.

processMathObject

java.lang.Object processMathObject(java.lang.Object pData)
This method provides a basic, generic extension point for custom MathPrinter implementations. Its use is not specified other than that, and none of the MathTools classes actually use it. All other details are implementation-specific. A non-implemented message should simply return the Object it is passed.

Parameters:
pData - The data to be processed.
Returns:
The result of processing the data given.