coins.driver
クラス Trace

java.lang.Object
  |
  +--coins.driver.Trace

public class Trace
extends java.lang.Object

Trace controller.
A trace controller is initialized by trace options specified in a command line and determines which trace message should be printed.
There are two types of trace messages: generic (category-free) trace messages and categorized trace messages. A trace message may have a message level which is an integer value. Trace messages without message levels are called level-less trace messages and treated as level-zero.
A trace option is one of COINS options and should be given in the form:

-coins:trace=tracespec/tracespec /...
where tracespecs can be level or category.level. When level is specified, generic trace messages whose level is below the level are shown. When category.level is specified, trace messages of category category whose level is below the level are shown. When more than one levels are specified, or more than one category.levels are specified for a same category, the latter one overwrites the formar one. A special category "default" is provided to specify a trace level of all trace categories (and category-less messages) except categories appeared in other tracespecs.
Trace controller holds a generic trace level and category-wise trace levels. A trace message whose message level is smaller than or equal to the corresponding trace level is determined to be printed, otherwise not. The generic trace level is for generic trace messages and a category-wise trace level of a message category is for trace messages of that category.


コンストラクタの概要
Trace(java.io.PrintStream out, java.lang.String traceArgument, Warning warning)
          Constructs a new trace controller, which prints trace messages specified to be printed by command line options.
Trace(java.io.PrintStream out, Warning warning)
          Constructs a new default trace controller, which prints no trace messages to a specified PrintStream.
Trace(Warning warning)
          Constructs a new default trace controller, which prints no trace messages to System.out.
 
メソッドの概要
 int getDefaultTraceLevel()
          Returns the default category trace level, which is used to determine whether a trace message whose category is not appeared in trace specifications should be printed or not.
 int getGenericTraceLevel()
          Returns the generic trace level, which is used to determine whether a generic (category free) trace message should be printed or not.
 int getTraceLevel(java.lang.String category)
          Return a category-wise trace level of a category.
 int setDefaultTraceLevel(int newLevel)
          Redefines the default trace level.
 int setGenericTraceLevel(int newLevel)
          Redefines the generic trace level.
 int setTraceLevel(java.lang.String category, int newLevel)
          Redefines a category-wise trace level.
 boolean shouldTrace()
          Tests if a generic level-less trace message should be printed or not.
 boolean shouldTrace(int level)
          Tests if a generic trace message of a certain level should be printed or not.
 boolean shouldTrace(java.lang.String category)
          Tests if a level-less trace message of a certain category should be printed or not.
 boolean shouldTrace(java.lang.String category, int level)
          Tests if a trace message of a certain category and level should be printed or not.
 void trace(int level, java.lang.String message)
          Prints a generic message of a certain message level when it should be printed.
 void trace(java.lang.String message)
          Prints a generic level-less trace message when it should be printed.
 void trace(java.lang.String category, int level, java.lang.String message)
          Prints a message of a certain message category and level when it should be printed.
 void trace(java.lang.String category, java.lang.String message)
          Prints a level-less message of a certain message category when it should be printed.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

Trace

public Trace(Warning warning)
Constructs a new default trace controller, which prints no trace messages to System.out.

パラメータ:
warning - warnings should go here.

Trace

public Trace(java.io.PrintStream out,
             Warning warning)
Constructs a new default trace controller, which prints no trace messages to a specified PrintStream.

パラメータ:
out - the trace output PrintStream.
warning - warnings should go here.

Trace

public Trace(java.io.PrintStream out,
             java.lang.String traceArgument,
             Warning warning)
Constructs a new trace controller, which prints trace messages specified to be printed by command line options. During parsing the options, some warning messages may be produced.

パラメータ:
out - the trace output PrintStream.
traceArgument - argument of the trace option.
warning - warnings should go here.
メソッドの詳細

shouldTrace

public boolean shouldTrace()
Tests if a generic level-less trace message should be printed or not. Returns true if the generic trace level is zero, false otherwise.


shouldTrace

public boolean shouldTrace(int level)
Tests if a generic trace message of a certain level should be printed or not. Returns true if the generic trace level is less than or equal to the message level, false otherwise.

パラメータ:
level - the message level

shouldTrace

public boolean shouldTrace(java.lang.String category)
Tests if a level-less trace message of a certain category should be printed or not. Returns true if the category-wise trace level of the category is specified, false otherwise.


shouldTrace

public boolean shouldTrace(java.lang.String category,
                           int level)
Tests if a trace message of a certain category and level should be printed or not. Returns true if the category-wise trace level of the category is less than or equal to the message level, false otherwise.


trace

public void trace(java.lang.String message)
Prints a generic level-less trace message when it should be printed.

パラメータ:
message - the message.

trace

public void trace(int level,
                  java.lang.String message)
Prints a generic message of a certain message level when it should be printed.

パラメータ:
level - the message level.
message - the message.

trace

public void trace(java.lang.String category,
                  java.lang.String message)
Prints a level-less message of a certain message category when it should be printed.

パラメータ:
message - the message.

trace

public void trace(java.lang.String category,
                  int level,
                  java.lang.String message)
Prints a message of a certain message category and level when it should be printed.

パラメータ:
level - the message level
message - the message

getGenericTraceLevel

public int getGenericTraceLevel()
Returns the generic trace level, which is used to determine whether a generic (category free) trace message should be printed or not.

戻り値:
the generic trace level.

getDefaultTraceLevel

public int getDefaultTraceLevel()
Returns the default category trace level, which is used to determine whether a trace message whose category is not appeared in trace specifications should be printed or not.

戻り値:
the default category trace level.

getTraceLevel

public int getTraceLevel(java.lang.String category)
Return a category-wise trace level of a category. This method simply returns a trace level specified in a compile specification. You should use one of shouldTrace methods to see if some trace messages should be printed or not.

パラメータ:
category - the category.
戻り値:
a category-wise trace level.

setGenericTraceLevel

public int setGenericTraceLevel(int newLevel)
Redefines the generic trace level.

パラメータ:
newLevel - a new value of the generic trace level.
戻り値:
an old value of the generic trace level.

setDefaultTraceLevel

public int setDefaultTraceLevel(int newLevel)
Redefines the default trace level.

パラメータ:
newLevel - a new value of the default trace level.
戻り値:
an old value of the default trace level.

setTraceLevel

public int setTraceLevel(java.lang.String category,
                         int newLevel)
Redefines a category-wise trace level.

パラメータ:
category - a message category.
newLevel - a new value of the category-wise trace level.
戻り値:
an old value of the category-wise trace level.