📄 direction.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 Direction</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="Debug.html"><B>PREV CLASS</B></A> <A HREF="EnvDisplay.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="Direction.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <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 Direction</H2><PRE>java.lang.Object | +--<B>Direction</B></PRE><HR><DL><DT>public class <B>Direction</B><DT>extends java.lang.Object</DL><P>AP® Computer Science Marine Biology Simulation:<br> The <code>Direction</code> class encapsulates the notion of a compass direction such as North, East, South, West. <p> The <code>Direction</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 =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="Direction.html">Direction</A></CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#EAST">EAST</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#FULL_CIRCLE">FULL_CIRCLE</A></B></CODE><BR> Number of degrees in compass (will not be tested on the Advanced Placement exam).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="Direction.html">Direction</A></CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#NORTH">NORTH</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="Direction.html">Direction</A></CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#NORTHEAST">NORTHEAST</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="Direction.html">Direction</A></CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#NORTHWEST">NORTHWEST</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="Direction.html">Direction</A></CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#SOUTH">SOUTH</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="Direction.html">Direction</A></CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#SOUTHEAST">SOUTHEAST</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="Direction.html">Direction</A></CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#SOUTHWEST">SOUTHWEST</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="Direction.html">Direction</A></CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#WEST">WEST</A></B></CODE><BR> </TD></TR></TABLE> <!-- ======== 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="Direction.html#Direction()">Direction</A></B>()</CODE><BR> Constructs a default <code>Direction</code> object facing North.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="Direction.html#Direction(int)">Direction</A></B>(int degrees)</CODE><BR> Constructs a <code>Direction</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="Direction.html#Direction(java.lang.String)">Direction</A></B>(java.lang.String str)</CODE><BR> Constructs a <code>Direction</code> object.</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> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#equals(java.lang.Object)">equals</A></B>(java.lang.Object other)</CODE><BR> Indicates whether some other <code>Direction</code> object is "equal to" this one.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#hashCode()">hashCode</A></B>()</CODE><BR> Generates a hash code for this direction (will not be tested on the Advanced Placement exam).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#inDegrees()">inDegrees</A></B>()</CODE><BR> Returns this direction value in degrees.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="Direction.html">Direction</A></CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#randomDirection()">randomDirection</A></B>()</CODE><BR> Returns a random direction.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="Direction.html">Direction</A></CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#reverse()">reverse</A></B>()</CODE><BR> Returns the direction that is the reverse of this <code>Direction</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="Direction.html">Direction</A></CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#roundedDir(int, Direction)">roundedDir</A></B>(int numDirections, <A HREF="Direction.html">Direction</A> startingDir)</CODE><BR> Rounds this direction to the nearest "cardinal" direction (will not be tested on the Advanced Placement exam).<br> The choice of possible cardinal directions depends on the number of cardinal directions and the starting direction.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="Direction.html">Direction</A></CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#toLeft()">toLeft</A></B>()</CODE><BR> Returns the direction that is a quarter turn to the left of this <code>Direction</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="Direction.html">Direction</A></CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#toLeft(int)">toLeft</A></B>(int deg)</CODE><BR> Returns the direction that is <code>deg</code> degrees to the left of this <code>Direction</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="Direction.html">Direction</A></CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#toRight()">toRight</A></B>()</CODE><BR> Returns the direction that is a quarter turn to the right of this <code>Direction</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="Direction.html">Direction</A></CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#toRight(int)">toRight</A></B>(int deg)</CODE><BR> Returns the direction that is <code>deg</code> degrees to the right of this <code>Direction</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="Direction.html#toString()">toString</A></B>()</CODE><BR> Represents this direction as a string.</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, finalize, getClass, notify, notifyAll, wait, wait, wait</CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -