程序包 weka.core

类 Debug

java.lang.Object
weka.core.Debug
所有已实现的接口:
Serializable, RevisionHandler

public class Debug extends Object implements Serializable, RevisionHandler
A helper class for debug output, logging, clocking, etc.
版本:
$Revision: 7519 $
作者:
fracpete (fracpete at waikato dot ac dot nz)
另请参阅:
  • 嵌套类概要

    嵌套类
    修饰符和类型
    说明
    static class 
    A little helper class for clocking and outputting times.
    static class 
    contains debug methods
    static class 
    A helper class for logging stuff.
    static class 
    This extended Random class enables one to print the generated random numbers etc., before they are returned.
    static class 
    A little, simple helper class for logging stuff.
    static class 
    A class that can be used for timestamps in files, The toString() method simply returns the associated Date object in a timestamp format.
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    static final Level
    the log level All
    static final Level
    the log level Vonfig
    static final Level
    the log level Fine
    static final Level
    the log level Finer
    static final Level
    the log level Finest
    static final Level
    the log level Info
    static final Level
    the log level Off - i.e., no logging
    static final Level
    the log level Severe
    static final Level
    the log level Warning
  • 构造器概要

    构造器
    构造器
    说明
    default constructor, prints only to stdout
    Debug(String filename)
    logs the output to the specified file (and stdout).
    Debug(String filename, int size, int numFiles)
    logs the output
  • 方法概要

    修饰符和类型
    方法
    说明
    returns the instance of the Clock that is internally used
    static String
    returns the current working directory of the user
    boolean
    returns whether the logging is enabled
    static String
    returns the home directory of the user
    Returns the revision string.
    static String
    returns the system temp directory
    static Object
    loadFromFile(String filename)
    deserializes the content of the file and returns it, null if an error occurred.
    void
    log(String message)
    prints the given message with level INFO
    void
    log(Level level, String message)
    prints the given message with the specified level and an empty sourceclass
    void
    log(Level level, String sourceclass, String message)
    prints the given message with the specified level
    void
    log(Level level, String sourceclass, String sourcemethod, String message)
    prints the given message with the specified level
    returns a new instance of a clock
    static Debug.Log
    newLog(String filename, int size, int numFiles)
    returns a new Log instance
    static Random
    returns a default debug random object, with no particular seed and debugging enabled.
    static Random
    newRandom(int seed)
    returns a debug random object with the specified seed and debugging enabled.
    returns a default timestamp for the current date/time
    static boolean
    saveToFile(String filename, Object o)
    writes the serialized object to the speicified file
    void
    setEnabled(boolean value)
    sets whether the logging is enabled or not
    void
    starts the clock
    void
    stopClock(String message)
    stops the clock and prints the message associated with the time, but only if the logging is enabled.
    static Level
    turns the string representing a level, e.g., "FINE" or "ALL" into the corresponding level (case-insensitive).
    static boolean
    writeToFile(String filename, Object obj)
    Writes the given object to the specified file.
    static boolean
    writeToFile(String filename, Object obj, boolean append)
    Writes the given object to the specified file.
    static boolean
    writeToFile(String filename, String message)
    Writes the given message to the specified file.
    static boolean
    writeToFile(String filename, String message, boolean append)
    Writes the given message to the specified file.

    从类继承的方法 java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 字段详细资料

    • ALL

      public static final Level ALL
      the log level All
    • CONFIG

      public static final Level CONFIG
      the log level Vonfig
    • FINE

      public static final Level FINE
      the log level Fine
    • FINER

      public static final Level FINER
      the log level Finer
    • FINEST

      public static final Level FINEST
      the log level Finest
    • INFO

      public static final Level INFO
      the log level Info
    • OFF

      public static final Level OFF
      the log level Off - i.e., no logging
    • SEVERE

      public static final Level SEVERE
      the log level Severe
    • WARNING

      public static final Level WARNING
      the log level Warning
  • 构造器详细资料

    • Debug

      public Debug()
      default constructor, prints only to stdout
    • Debug

      public Debug(String filename)
      logs the output to the specified file (and stdout). Size is 1,000,000 bytes and 1 file.
      参数:
      filename - the name of the log
    • Debug

      public Debug(String filename, int size, int numFiles)
      logs the output
      参数:
      filename - the name of the log
      size - the size of the files in bytes
      numFiles - the number of files for rotating
  • 方法详细资料

    • stringToLevel

      public static Level stringToLevel(String level)
      turns the string representing a level, e.g., "FINE" or "ALL" into the corresponding level (case-insensitive). The default is ALL.
      参数:
      level - the string to return a level for
      返回:
      the corresponding level or the default
    • newLog

      public static Debug.Log newLog(String filename, int size, int numFiles)
      returns a new Log instance
      参数:
      filename - the name of the log
      size - the size of the files in bytes
      numFiles - the number of files for rotating
      返回:
      the log instance
    • log

      public void log(String message)
      prints the given message with level INFO
      参数:
      message - the message to print
    • log

      public void log(Level level, String message)
      prints the given message with the specified level and an empty sourceclass
      参数:
      level - the level of logging
      message - the message to print
    • log

      public void log(Level level, String sourceclass, String message)
      prints the given message with the specified level
      参数:
      level - the level of logging
      sourceclass - the class that logs the message
      message - the message to print
    • log

      public void log(Level level, String sourceclass, String sourcemethod, String message)
      prints the given message with the specified level
      参数:
      level - the level of logging
      sourceclass - the class that logs the message
      sourcemethod - the method that logs the message
      message - the message to print
    • setEnabled

      public void setEnabled(boolean value)
      sets whether the logging is enabled or not
      参数:
      value - if true logging will be enabled
    • getEnabled

      public boolean getEnabled()
      returns whether the logging is enabled
      返回:
      true if the logging is enabled
    • newClock

      public static Debug.Clock newClock()
      returns a new instance of a clock
      返回:
      a new instance of a Clock
    • getClock

      public Debug.Clock getClock()
      returns the instance of the Clock that is internally used
      返回:
      the clock that's being used
    • startClock

      public void startClock()
      starts the clock
    • stopClock

      public void stopClock(String message)
      stops the clock and prints the message associated with the time, but only if the logging is enabled.
      参数:
      message - the message to print
      另请参阅:
    • newRandom

      public static Random newRandom()
      returns a default debug random object, with no particular seed and debugging enabled.
      返回:
      a new instance of a Random object
    • newRandom

      public static Random newRandom(int seed)
      returns a debug random object with the specified seed and debugging enabled.
      参数:
      seed - the seed value
      返回:
      a new instance of a Random object
    • newTimestamp

      public static Debug.Timestamp newTimestamp()
      returns a default timestamp for the current date/time
      返回:
      a new timestamp
    • getTempDir

      public static String getTempDir()
      returns the system temp directory
      返回:
      the temp directory
    • getHomeDir

      public static String getHomeDir()
      returns the home directory of the user
      返回:
      the user's home directory
    • getCurrentDir

      public static String getCurrentDir()
      returns the current working directory of the user
      返回:
      the user's current working directory
    • writeToFile

      public static boolean writeToFile(String filename, Object obj)
      Writes the given object to the specified file. The string representation of the object is appended to the file.
      参数:
      filename - the file to write to
      obj - the object to write to the file
      返回:
      true if writing was successful
    • writeToFile

      public static boolean writeToFile(String filename, String message)
      Writes the given message to the specified file. The message is appended to the file.
      参数:
      filename - the file to write to
      message - the message to write
      返回:
      true if writing was successful
    • writeToFile

      public static boolean writeToFile(String filename, Object obj, boolean append)
      Writes the given object to the specified file. The string representation of the object is either appended or replaces the current content of the file.
      参数:
      filename - the file to write to
      obj - the object to write to the file
      append - whether to append the message or not
      返回:
      true if writing was successful
    • writeToFile

      public static boolean writeToFile(String filename, String message, boolean append)
      Writes the given message to the specified file. The message is either appended or replaces the current content of the file.
      参数:
      filename - the file to write to
      message - the message to write
      append - whether to append the message or not
      返回:
      true if writing was successful
    • saveToFile

      public static boolean saveToFile(String filename, Object o)
      writes the serialized object to the speicified file
      参数:
      filename - the file to serialize the object to
      o - the object to serialize
      返回:
      true if writing was successful
    • loadFromFile

      public static Object loadFromFile(String filename)
      deserializes the content of the file and returns it, null if an error occurred.
      参数:
      filename - the name of the file to deserialize
      返回:
      the deserialized content, null if problem occurred
    • getRevision

      public String getRevision()
      Returns the revision string.
      指定者:
      getRevision 在接口中 RevisionHandler
      返回:
      the revision