⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 debug.java

📁 ErGo是一个很早的Java通用围棋服务器(IGS/NNGS)客户端程序。有全部源码和文档
💻 JAVA
字号:
package ergo.util;

// $Id: Debug.java,v 1.3 1999/08/27 03:08:11 sigue Exp $

/*
 *  Copyright (C) 1999  Carl L. Gay and Antranig M. Basman.
 *  See the file copyright.txt, distributed with this software,
 *  for further information.
 */

/// Debugging code.
///
/// The rest of the classes use this to do conditional debugging output.

public final class Debug {
  private static boolean debugp = false;
  public  static boolean debugGameLogicp = false;

  public static void setDebug (boolean state) {
    debugp = state;
  }

  public static boolean getDebug () {
    return debugp;
  }

  public static void println (String s) {
    if (debugp)
      System.err.println(s);
  }

  /** Print a message with the current millisecond clock prepended.
   */
  public static void tprintln (String msg) {
    println(System.currentTimeMillis() + " " + Thread.currentThread() + ": " + msg);
  }

  public static void backtrace () {
    backtrace(new Exception());
  }

  public static void backtrace (Exception e) {
    if (debugp)
      e.printStackTrace();
  }

  public static void asser (boolean valid, String error) {
    if (!valid) {
      if (debugp) {
	AssertionFailureException e
	  = new AssertionFailureException("Assertion failed: " + error);
	backtrace(e);
	throw e;
      }
      else 
	System.err.println(error);
    }
  }

} // end class Debug

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -