Qizx/Open v0.4

net.xfra.qizxopen.xquery
Class Log

java.lang.Object
  |
  +--net.xfra.qizxopen.xquery.Log

public class Log
extends java.lang.Object

A message log for XQuery parsing, static and dynamic analysis.

In the default implementation, messages are both printed immediately and stored for later retrieval.

Message locations are character offsets in an input text sequence.

An overloadable method allows to redefine message display. Messages can also be retrieved individually.


Nested Class Summary
static class Log.Message
          Storage of a message.
 
Field Summary
static int ERROR
           
static int INFO
           
static int TRACE
           
static int WARNING
           
 
Constructor Summary
Log()
          Creates a default Log with output on the standard error stream.
Log(java.io.PrintWriter errorStream)
          Creates a default Log with output on a stream.
 
Method Summary
 void error(net.xfra.qizxopen.xquery.impl.Module module, int location, java.lang.String message)
          Logs an error.
 void error(net.xfra.qizxopen.xquery.impl.Module module, int location, java.lang.String message, java.lang.String arg)
          Logs an error.
 void error(net.xfra.qizxopen.xquery.impl.Module module, int location, java.lang.String message, java.lang.String[] arguments)
          Logs an error.
 void error(net.xfra.qizxopen.xquery.impl.Module module, int location, java.lang.String message, java.lang.String arg1, java.lang.String arg2)
          Logs an error.
 void flush()
          Flushes the output.
static int getColumn(java.lang.CharSequence input, int location)
          Returns the column number, given the location offset and the input text.
 int getErrorCount()
          Returns the number of errors since the last reset().
static java.lang.String getLine(java.lang.CharSequence input, int location)
          Returns the line text, given the location offset and the input text.
static int getLineNumber(java.lang.CharSequence input, int location)
          Returns the line number, given the location offset and the input text.
 Log.Message getMessage(int rank)
          Retrieves a message by its rank.
 int getMessageCount()
          Returns the total number of messages since the last reset().
 void info(net.xfra.qizxopen.xquery.impl.Module module, int location, java.lang.String message)
           
 void info(java.lang.String message)
          Supplementary information.
 void printMessage(Log.Message msg)
          Overloadable display method.
 void reset()
          Clears the messages and the error count.
 void trace(net.xfra.qizxopen.xquery.impl.Module module, int location, java.lang.String message, java.lang.String[] arguments)
           
 void warning(net.xfra.qizxopen.xquery.impl.Module module, int location, java.lang.String message, java.lang.String arg)
           
 void warning(net.xfra.qizxopen.xquery.impl.Module module, int location, java.lang.String message, java.lang.String[] arguments)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INFO

public static final int INFO
See Also:
Constant Field Values

TRACE

public static final int TRACE
See Also:
Constant Field Values

WARNING

public static final int WARNING
See Also:
Constant Field Values

ERROR

public static final int ERROR
See Also:
Constant Field Values
Constructor Detail

Log

public Log()
Creates a default Log with output on the standard error stream.


Log

public Log(java.io.PrintWriter errorStream)
Creates a default Log with output on a stream.

Method Detail

reset

public void reset()
Clears the messages and the error count.


getMessageCount

public int getMessageCount()
Returns the total number of messages since the last reset().


getErrorCount

public int getErrorCount()
Returns the number of errors since the last reset().


getMessage

public Log.Message getMessage(int rank)
Retrieves a message by its rank.


flush

public void flush()
Flushes the output.


error

public void error(net.xfra.qizxopen.xquery.impl.Module module,
                  int location,
                  java.lang.String message,
                  java.lang.String[] arguments)
Logs an error. Called by the parser, the type checking or the runtime.

Parameters:
location - character offset of the error location.
message - text of the message. Can contain references to arguments of the form '%n'.

error

public void error(net.xfra.qizxopen.xquery.impl.Module module,
                  int location,
                  java.lang.String message)
Logs an error. Called by the parser, the type checking or the runtime.


error

public void error(net.xfra.qizxopen.xquery.impl.Module module,
                  int location,
                  java.lang.String message,
                  java.lang.String arg)
Logs an error. Called by the parser, the type checking or the runtime.


error

public void error(net.xfra.qizxopen.xquery.impl.Module module,
                  int location,
                  java.lang.String message,
                  java.lang.String arg1,
                  java.lang.String arg2)
Logs an error. Called by the parser, the type checking or the runtime.


warning

public void warning(net.xfra.qizxopen.xquery.impl.Module module,
                    int location,
                    java.lang.String message,
                    java.lang.String[] arguments)

warning

public void warning(net.xfra.qizxopen.xquery.impl.Module module,
                    int location,
                    java.lang.String message,
                    java.lang.String arg)

trace

public void trace(net.xfra.qizxopen.xquery.impl.Module module,
                  int location,
                  java.lang.String message,
                  java.lang.String[] arguments)

info

public void info(java.lang.String message)
Supplementary information.


info

public void info(net.xfra.qizxopen.xquery.impl.Module module,
                 int location,
                 java.lang.String message)

printMessage

public void printMessage(Log.Message msg)
Overloadable display method.


getLineNumber

public static int getLineNumber(java.lang.CharSequence input,
                                int location)
Returns the line number, given the location offset and the input text.


getColumn

public static int getColumn(java.lang.CharSequence input,
                            int location)
Returns the column number, given the location offset and the input text.


getLine

public static java.lang.String getLine(java.lang.CharSequence input,
                                       int location)
Returns the line text, given the location offset and the input text.


 Copyright Xavier FRANC 2003-2004