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

📄 environment.html

📁 java学习的好范例
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="numRows()"><!-- --></A><H3>numRows</H3><PRE>public int <B>numRows</B>()</PRE><DL><DD>Returns number of rows in this environment.<DD><DL><DT><B>Returns:</B><DD>the number of rows, or -1 if the environment is unbounded</DL></DD></DL><HR><A NAME="numCols()"><!-- --></A><H3>numCols</H3><PRE>public int <B>numCols</B>()</PRE><DL><DD>Returns number of columns in this environment.<DD><DL><DT><B>Returns:</B><DD>the number of columns, or -1 if the environment is unbounded</DL></DD></DL><HR><A NAME="isValid(Location)"><!-- --></A><H3>isValid</H3><PRE>public boolean <B>isValid</B>(<A HREF="Location.html">Location</A>&nbsp;loc)</PRE><DL><DD>Verifies whether a location is valid in this environment.<DD><DL><DT><B>Parameters:</B><DD><CODE>loc</CODE> - location to check<DT><B>Returns:</B><DD><code>true</code> if <code>loc</code> is valid;          <code>false</code> otherwise</DL></DD></DL><HR><A NAME="numCellSides()"><!-- --></A><H3>numCellSides</H3><PRE>public int <B>numCellSides</B>()</PRE><DL><DD>Returns the number of sides around each cell.<DD><DL><DT><B>Returns:</B><DD>the number of cell sides in this environment</DL></DD></DL><HR><A NAME="numAdjacentNeighbors()"><!-- --></A><H3>numAdjacentNeighbors</H3><PRE>public int <B>numAdjacentNeighbors</B>()</PRE><DL><DD>Returns the number of adjacent neighbors around each cell.<DD><DL><DT><B>Returns:</B><DD>the number of adjacent neighbors</DL></DD></DL><HR><A NAME="randomDirection()"><!-- --></A><H3>randomDirection</H3><PRE>public <A HREF="Direction.html">Direction</A> <B>randomDirection</B>()</PRE><DL><DD>Generates a random direction.  The direction returned by  <code>randomDirection</code> reflects the direction from  a cell in the environment to one of its adjacent neighbors.<DD><DL><DT><B>Returns:</B><DD>a direction</DL></DD></DL><HR><A NAME="getDirection(Location, Location)"><!-- --></A><H3>getDirection</H3><PRE>public <A HREF="Direction.html">Direction</A> <B>getDirection</B>(<A HREF="Location.html">Location</A>&nbsp;fromLoc,                              <A HREF="Location.html">Location</A>&nbsp;toLoc)</PRE><DL><DD>Returns the direction from one location to another.<DD><DL><DT><B>Parameters:</B><DD><CODE>fromLoc</CODE> - starting location for search<DD><CODE>toLoc</CODE> - destination location<DT><B>Returns:</B><DD>direction from <code>fromLoc</code> to <code>toLoc</code></DL></DD></DL><HR><A NAME="getNeighbor(Location, Direction)"><!-- --></A><H3>getNeighbor</H3><PRE>public <A HREF="Location.html">Location</A> <B>getNeighbor</B>(<A HREF="Location.html">Location</A>&nbsp;fromLoc,                            <A HREF="Direction.html">Direction</A>&nbsp;compassDir)</PRE><DL><DD>Returns the adjacent neighbor (whether valid or invalid) of a location  in the specified direction.<DD><DL><DT><B>Parameters:</B><DD><CODE>fromLoc</CODE> - starting location for search<DD><CODE>compassDir</CODE> - direction in which to look for adjacent neighbor<DT><B>Returns:</B><DD>neighbor of <code>fromLoc</code> in given direction</DL></DD></DL><HR><A NAME="neighborsOf(Location)"><!-- --></A><H3>neighborsOf</H3><PRE>public java.util.ArrayList <B>neighborsOf</B>(<A HREF="Location.html">Location</A>&nbsp;ofLoc)</PRE><DL><DD>Returns the adjacent neighbors of a specified location.  Only neighbors that are valid locations in the environment will be  included.<DD><DL><DT><B>Parameters:</B><DD><CODE>ofLoc</CODE> - location whose neighbors to get<DT><B>Returns:</B><DD>a list of locations that are neighbors of <code>ofLoc</code></DL></DD></DL><HR><A NAME="numObjects()"><!-- --></A><H3>numObjects</H3><PRE>public int <B>numObjects</B>()</PRE><DL><DD>Returns the number of objects in this environment.<DD><DL><DT><B>Returns:</B><DD>the number of objects</DL></DD></DL><HR><A NAME="allObjects()"><!-- --></A><H3>allObjects</H3><PRE>public <A HREF="Locatable.html">Locatable</A>[] <B>allObjects</B>()</PRE><DL><DD>Returns all the objects in this environment.<DD><DL><DT><B>Returns:</B><DD>an array of all the environment objects</DL></DD></DL><HR><A NAME="isEmpty(Location)"><!-- --></A><H3>isEmpty</H3><PRE>public boolean <B>isEmpty</B>(<A HREF="Location.html">Location</A>&nbsp;loc)</PRE><DL><DD>Determines whether a specific location in this environment is  empty.<DD><DL><DT><B>Parameters:</B><DD><CODE>loc</CODE> - the location to test<DT><B>Returns:</B><DD><code>true</code> if <code>loc</code> is a              valid location in the context of this environment              and is empty; <code>false</code> otherwise</DL></DD></DL><HR><A NAME="objectAt(Location)"><!-- --></A><H3>objectAt</H3><PRE>public <A HREF="Locatable.html">Locatable</A> <B>objectAt</B>(<A HREF="Location.html">Location</A>&nbsp;loc)</PRE><DL><DD>Returns the object at a specific location in this environment.<DD><DL><DT><B>Parameters:</B><DD><CODE>loc</CODE> - the location in which to look<DT><B>Returns:</B><DD>the object at location <code>loc</code>;                <code>null</code> if <code>loc</code> is not                in the environment or is empty</DL></DD></DL><HR><A NAME="add(Locatable)"><!-- --></A><H3>add</H3><PRE>public void <B>add</B>(<A HREF="Locatable.html">Locatable</A>&nbsp;obj)</PRE><DL><DD>Adds a new object to this environment at the location it specifies.  (Precondition: <code>obj.location()</code> is a valid empty location.)<DD><DL><DT><B>Parameters:</B><DD><CODE>obj</CODE> - the new object to be added<DT><B>Throws:</B><DD><CODE>java.lang.IllegalArgumentException</CODE> - if the precondition is not met</DL></DD></DL><HR><A NAME="remove(Locatable)"><!-- --></A><H3>remove</H3><PRE>public void <B>remove</B>(<A HREF="Locatable.html">Locatable</A>&nbsp;obj)</PRE><DL><DD>Removes the object from this environment.  (Precondition: <code>obj</code> is in this environment.)<DD><DL><DT><B>Parameters:</B><DD><CODE>obj</CODE> - the object to be removed<DT><B>Throws:</B><DD><CODE>java.lang.IllegalArgumentException</CODE> - if the precondition is not met</DL></DD></DL><HR><A NAME="recordMove(Locatable, Location)"><!-- --></A><H3>recordMove</H3><PRE>public void <B>recordMove</B>(<A HREF="Locatable.html">Locatable</A>&nbsp;obj,                       <A HREF="Location.html">Location</A>&nbsp;oldLoc)</PRE><DL><DD>Updates this environment to reflect the fact that an object moved.  (Precondition: <code>obj.location()</code> is a valid location  and there is no other object there.  Postcondition: <code>obj</code> is at the appropriate location  (<code>obj.location()</code>), and either <code>oldLoc</code> is   equal to <code>obj.location()</code> (there was no movement) or  <code>oldLoc</code> is empty.)<DD><DL><DT><B>Parameters:</B><DD><CODE>obj</CODE> - the object that moved<DD><CODE>oldLoc</CODE> - the previous location of <code>obj</code><DT><B>Throws:</B><DD><CODE>java.lang.IllegalArgumentException</CODE> - if the precondition is not met</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"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>AP&reg; Computer Science Marine Biology Simulation</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="EnvDisplay.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="Fish.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>  &nbsp;&nbsp;<A HREF="Environment.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><i>Copyright&copy; 2002 College Entrance Examination Board</i></BODY></HTML>

⌨️ 快捷键说明

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