📄 debug.java
字号:
package edu.odu.cs.zeil.AlgAE;import java.awt.Dimension;import java.awt.Frame;import java.awt.Insets;import java.awt.Point;import java.io.PrintWriter;import edu.odu.cs.zeil.AlgAE.TextDialog;class GCAnnouncer { GCAnnouncer() {} protected void finalize() throws Throwable { Debug.debug ("GC finalization detected"); GCAnnouncer gca = new GCAnnouncer(); }} public class Debug{ public static boolean debug = true; public static boolean events = false; public static boolean edgeScore = false; public static boolean garbageCollector = false; public static boolean positionScore = false; public static boolean edgePositionScore = false; public static boolean reposition = false; public static boolean directionTo = false; public static boolean timer = false; public static boolean entryPoint = false; public static boolean edgeDraw = false; public static boolean graphDraw = false; public static boolean recenter = false; public static boolean messageSynch = false; public static boolean tokenizer = false; public static boolean splitters = false; public static boolean sockets = false; public static boolean clientread = false; public static boolean sourceCode = false; public static boolean threads = false; public static boolean termination = false; public static boolean image = false; public static PrintWriter out = null; // new PrintWriter(System.out); public static Frame theFrame = null; public static void debug (String message) { if (out != null) { out.println (message); out.flush(); } } public static void error (String message) { debug (message); if (theFrame != null) { TextDialog td = new TextDialog (theFrame, message); } } public static void show (boolean flag, String message) { if (flag && (out != null)) debug (message); } public static void show (boolean flag, String message, int value) { if (flag && (out != null)) debug (message + value); } public static void show (boolean flag, String message, boolean value) { if (flag && (out != null)) debug (message + value); } public static void show (boolean flag, String message, double value) { if (flag && (out != null)) debug (message + value); } public static void show (boolean flag, String message, Point value) { if (flag && (out != null)) debug (message + "(" + value.x + ", " + value.y + ")"); } public static void show (boolean flag, String message, Dimension value) { if (flag && (out != null)) debug (message + "[" + value.width + ", " + value.height + "]"); } public static void show (boolean flag, String message, Insets value) { if (flag && (out != null)) debug (message + value); } public static void show (boolean flag, String message, String value) { if (flag && (out != null)) debug (message + "\"" + value + "\""); } public static void assert (boolean flag, boolean test, String message) { if (!test) show (flag, "Assertion violated: " + message); } public static void watchForGC() { if (garbageCollector) { GCAnnouncer gca = new GCAnnouncer(); } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -