📄 debug.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Aug 22 02:03:57 EDT 2002 --><TITLE>Marine Biology Simulation: Class Debug</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>AP® Computer Science Marine Biology Simulation</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="DarterFish.html"><B>PREV CLASS</B></A> <A HREF="Direction.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="Debug.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2>Class Debug</H2><PRE>java.lang.Object | +--<B>Debug</B></PRE><HR><DL><DT>public class <B>Debug</B><DT>extends java.lang.Object</DL><P>AP® Computer Science Marine Biology Simulation:<br> The <code>Debug</code> class supports conditional printing of debugging messages. <p> The <code>turnOn</code> and <code>turnOff</code> methods cause the previous debugging state to be saved on a stack so that it can be restored later using the <code>restoreState</code> method. <p> For example, consider the following scenario. Method 1 turns on debugging and calls Method 2. Method 2, not knowing that debugging is already on, turns debugging on and calls Method 3. Method 3 turns debugging off. Before returning, Method 3 restores the previous state, which turns debugging back on (as set by Method 2). Before Method 2 returns, it also restores the state, which will leave debugging on (as set by Method 1). This is illustrated in the pseudo-code below. <pre> in Method 1: (A: in Method 1; we don't know debugging state) turn on debugging (debugging state is now on; Debug.println will print) call Method 2 (B: now in Method 2; debugging state is unchanged (on)) turn on debugging (debugging state is on (still)) call Method 3 (C: now in Method 3; debugging state is unchanged (on)) turn off debugging (debugging state is now off; Debug.println will not print) restore state (debugging state is restored to what it was at point C (on)) return to Method 2 (D: now in Method 2; debugging state is unchanged (still on)) restore state (debugging state is still on because it was on at point B) return to Method 1 (E: now in Method 1; debugging state unchanged (still on)) restore state (debugging state is whatever it was at point A (unknown)) </pre> Note that when Method 2 restores the debugging state, it does not go back to its most recent state, which would be off (as set by Method 3). State restoration is controlled by a stack, not by a toggle. <p> The <code>Debug</code> class is copyright© 2002 College Entrance Examination Board (www.collegeboard.com).<P><DL><DT><B>Version: </B><DD>1 July 2002</DD></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="Debug.html#Debug()">Debug</A></B>()</CODE><BR> </TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static boolean</CODE></FONT></TD><TD><CODE><B><A HREF="Debug.html#isOff()">isOff</A></B>()</CODE><BR> Checks whether debugging is off.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static boolean</CODE></FONT></TD><TD><CODE><B><A HREF="Debug.html#isOn()">isOn</A></B>()</CODE><BR> Checks whether debugging is on.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="Debug.html#print(java.lang.String)">print</A></B>(java.lang.String message)</CODE><BR> Prints debugging message without appending a newline character at the end.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="Debug.html#println(java.lang.String)">println</A></B>(java.lang.String message)</CODE><BR> Prints debugging message, appending a newline character at the end.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="Debug.html#restoreState()">restoreState</A></B>()</CODE><BR> Restores the previous debugging state.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="Debug.html#turnOff()">turnOff</A></B>()</CODE><BR> Turns debugging off.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="Debug.html#turnOn()">turnOn</A></B>()</CODE><BR> Turns debugging on.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.Object</B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="Debug()"><!-- --></A><H3>Debug</H3><PRE>public <B>Debug</B>()</PRE><DL></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="isOn()"><!-- --></A><H3>isOn</H3><PRE>public static boolean <B>isOn</B>()</PRE><DL><DD>Checks whether debugging is on. The <code>Debug.print</code> and <code>Debug.println</code>) methods use <code>isOn</code> to decide whether or not to print.</DL><HR><A NAME="isOff()"><!-- --></A><H3>isOff</H3><PRE>public static boolean <B>isOff</B>()</PRE><DL><DD>Checks whether debugging is off.</DL><HR><A NAME="turnOn()"><!-- --></A><H3>turnOn</H3><PRE>public static void <B>turnOn</B>()</PRE><DL><DD>Turns debugging on.</DL><HR><A NAME="turnOff()"><!-- --></A><H3>turnOff</H3><PRE>public static void <B>turnOff</B>()</PRE><DL><DD>Turns debugging off.</DL><HR><A NAME="restoreState()"><!-- --></A><H3>restoreState</H3><PRE>public static void <B>restoreState</B>()</PRE><DL><DD>Restores the previous debugging state. If there is no previous state to restore, <code>restoreState</code> turns debugging off.</DL><HR><A NAME="print(java.lang.String)"><!-- --></A><H3>print</H3><PRE>public static void <B>print</B>(java.lang.String message)</PRE><DL><DD>Prints debugging message without appending a newline character at the end. If debugging is turned on, <code>message</code> is printed to <code>System.out</code> without a newline.<DD><DL><DT><B>Parameters:</B><DD><CODE>message</CODE> - debugging message to print</DL></DD></DL><HR><A NAME="println(java.lang.String)"><!-- --></A><H3>println</H3><PRE>public static void <B>println</B>(java.lang.String message)</PRE><DL><DD>Prints debugging message, appending a newline character at the end. If debugging is turned on, <code>message</code> is printed to <code>System.out</code> followed by a newline.<DD><DL><DT><B>Parameters:</B><DD><CODE>message</CODE> - debugging message to print</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>AP® Computer Science Marine Biology Simulation</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="DarterFish.html"><B>PREV CLASS</B></A> <A HREF="Direction.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="Debug.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><i>Copyright© 2002 College Entrance Examination Board</i></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -