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

📄 animal.html

📁 卡耐基梅隆大学 SSD课程体系 ssd1 exesice8 答案
💻 HTML
📖 第 1 页 / 共 2 页
字号:
&nbsp;<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>
&nbsp;
<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">
<B>Field Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="RIGHT"><!-- --></A><H3>
RIGHT</H3>
<PRE>
protected static final java.lang.String <B>RIGHT</B></PRE>
<DL>
<DD>String constant - used to indicate the direction animal is facing.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="constant-values.html#Animal.RIGHT">Constant Field Values</A></DL>
</DL>
<HR>

<A NAME="LEFT"><!-- --></A><H3>
LEFT</H3>
<PRE>
protected static final java.lang.String <B>LEFT</B></PRE>
<DL>
<DD>String constant - used to indicate the direction animal is facing.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="constant-values.html#Animal.LEFT">Constant Field Values</A></DL>
</DL>
<HR>

<A NAME="UP"><!-- --></A><H3>
UP</H3>
<PRE>
protected static final java.lang.String <B>UP</B></PRE>
<DL>
<DD>String constant - used to indicate the direction animal is facing.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="constant-values.html#Animal.UP">Constant Field Values</A></DL>
</DL>
<HR>

<A NAME="DOWN"><!-- --></A><H3>
DOWN</H3>
<PRE>
protected static final java.lang.String <B>DOWN</B></PRE>
<DL>
<DD>String constant - used to indicate the direction animal is facing.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="constant-values.html#Animal.DOWN">Constant Field Values</A></DL>
</DL>

<!-- ========= 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="Animal(int, int, Simulation, java.lang.String, int, int)"><!-- --></A><H3>
Animal</H3>
<PRE>
public <B>Animal</B>(int&nbsp;initialRow,
              int&nbsp;initialColumn,
              Simulation&nbsp;initialSimulation,
              java.lang.String&nbsp;initialName,
              int&nbsp;minEnergy,
              int&nbsp;maxEnergy)</PRE>
<DL>
<DD>Create an animal at a given location with a 
 given energy and store the simulation to which the animal belongs.
 Cap row and column within lake boundary.
<P>
<DT><B>Parameters:</B><DD><CODE>initialRow</CODE> - - the row location of animal<DD><CODE>initialColumn</CODE> - - the column locaiton of animal<DD><CODE>initialSimulation</CODE> - - the simulation to which this animal belongs<DD><CODE>initialName</CODE> - - name of the animal</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="getDirection()"><!-- --></A><H3>
getDirection</H3>
<PRE>
protected java.lang.String <B>getDirection</B>()</PRE>
<DL>
<DD>Get the direction faced by the animal.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the facing direction.</DL>
</DD>
</DL>
<HR>

<A NAME="isHungry()"><!-- --></A><H3>
isHungry</H3>
<PRE>
protected boolean <B>isHungry</B>()</PRE>
<DL>
<DD>Is the animal hungry?
<P>
<DD><DL>

<DT><B>Returns:</B><DD>True, if hungry. False, otherwise.</DL>
</DD>
</DL>
<HR>

<A NAME="moveToRow(int)"><!-- --></A><H3>
moveToRow</H3>
<PRE>
protected int <B>moveToRow</B>(int&nbsp;newRow)</PRE>
<DL>
<DD>Move the animal to a new row, if new row is within lake bounds.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>newRow</CODE> - - the row to move to.
<DT><B>Returns:</B><DD>the row moved to. Lake boundary limits movement. -1, if dead</DL>
</DD>
</DL>
<HR>

<A NAME="moveToColumn(int)"><!-- --></A><H3>
moveToColumn</H3>
<PRE>
protected int <B>moveToColumn</B>(int&nbsp;newColumn)</PRE>
<DL>
<DD>Move the animal to a new column, if new column is within lake bounds.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>newColumn</CODE> - - the column to move to.
<DT><B>Returns:</B><DD>the column moved to. Lake boundary limits movement.</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=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">      <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Package</FONT>&nbsp;</TD>
&nbsp;</TD>
  <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="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</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>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="AlgaeColony.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="LivingBeing.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="Animal.html" TARGET="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;
<SCRIPT>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>

</BODY>
</HTML>

⌨️ 快捷键说明

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