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

📄 livingbeing.html

📁 exm 3 Object-Oriented Programming and Design Introduction This course introduces students to proble
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<DD>Row-wise location of the living being
<P>
<DL>
</DL>
</DL>
<HR>

<A NAME="column"><!-- --></A><H3>
column</H3>
<PRE>
protected int <B>column</B></PRE>
<DL>
<DD>Column-wise location of the living being
<P>
<DL>
</DL>
</DL>
<HR>

<A NAME="simulation"><!-- --></A><H3>
simulation</H3>
<PRE>
protected Simulation <B>simulation</B></PRE>
<DL>
<DD>The simulation to which this living being belongs.
 This is needed so the living being can send a message 
 to simulation and ask
 for prey (or predator) in the neighboring locations. 
 Prey is food. Food is good!
<P>
<DL>
</DL>
</DL>
<HR>

<A NAME="minEnergy"><!-- --></A><H3>
minEnergy</H3>
<PRE>
protected int <B>minEnergy</B></PRE>
<DL>
<DD>Minimum energy level needed to survive.
 The minimum could increase as the individual grows.
<P>
<DL>
</DL>
</DL>
<HR>

<A NAME="maxEnergy"><!-- --></A><H3>
maxEnergy</H3>
<PRE>
protected int <B>maxEnergy</B></PRE>
<DL>
<DD>Maximum energy level that the living being could carry.
 The maximum could change as the individual grows.
<P>
<DL>
</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="LivingBeing(int, int, Simulation, java.lang.String, int, int)"><!-- --></A><H3>
LivingBeing</H3>
<PRE>
protected <B>LivingBeing</B>(int&nbsp;initialRow,
                      int&nbsp;initialColumn,
                      Simulation&nbsp;initialSimulation,
                      java.lang.String&nbsp;initialName,
                      int&nbsp;initialMinEnergy,
                      int&nbsp;initialMaxEnergy)</PRE>
<DL>
<DD>Create a living being at a given location with a 
 given energy and store the simulation to which the living being belongs.
 Cap row and column within lake boundary.
<P>
<DT><B>Parameters:</B><DD><CODE>initialRow</CODE> - - the row location of living being<DD><CODE>initialColumn</CODE> - - the column locaiton of living being<DD><CODE>initialSimulation</CODE> - - the simulation to which this being belongs<DD><CODE>initialName</CODE> - - name of the living being<DD><CODE>initialMinEnergy</CODE> - - minimum energy to survive<DD><CODE>initialMaxEnergy</CODE> - - max energy the living being can carry</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="createLivingBeing(Simulation, java.lang.String, java.lang.String)"><!-- --></A><H3>
createLivingBeing</H3>
<PRE>
public static void <B>createLivingBeing</B>(Simulation&nbsp;sim,
                                     java.lang.String&nbsp;species,
                                     java.lang.String&nbsp;value)</PRE>
<DL>
<DD>Create an organism that belongs to a specified species at
 a specified location and add it to the specified simulation.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>species</CODE> - - the organism's species<DD><CODE>value</CODE> - - row and column values specified as String from HTML form.
 row value is the last two digits, 
 column value is given in the remaining digits.</DL>
</DD>
</DL>
<HR>

<A NAME="getRow()"><!-- --></A><H3>
getRow</H3>
<PRE>
public int <B>getRow</B>()</PRE>
<DL>
<DD>Get the row at which the living being is located
<P>
<DD><DL>

<DT><B>Returns:</B><DD>- the row of the living being's location.</DL>
</DD>
</DL>
<HR>

<A NAME="getColumn()"><!-- --></A><H3>
getColumn</H3>
<PRE>
public int <B>getColumn</B>()</PRE>
<DL>
<DD>Get the column at which the living being is located
<P>
<DD><DL>

<DT><B>Returns:</B><DD>- the column of the living being's location.</DL>
</DD>
</DL>
<HR>

<A NAME="getAge()"><!-- --></A><H3>
getAge</H3>
<PRE>
public int <B>getAge</B>()</PRE>
<DL>
<DD>Get the living being's age
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the age of the living being expressed in blocks of time</DL>
</DD>
</DL>
<HR>

<A NAME="getColor()"><!-- --></A><H3>
getColor</H3>
<PRE>
public java.lang.String <B>getColor</B>()</PRE>
<DL>
<DD>Color of the living being expressed in hex notation.
 For example, the "green-est" color is "#00FF00",
 "blue-est" is "#0000FF", the "red-est" is "#FF0000".
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the rgb color in hex notation. preceded by a pound character '#'</DL>
</DD>
</DL>
<HR>

<A NAME="getName()"><!-- --></A><H3>
getName</H3>
<PRE>
public java.lang.String <B>getName</B>()</PRE>
<DL>
<DD>Get the name of this living being
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the name of the living being.</DL>
</DD>
</DL>
<HR>

<A NAME="getImage()"><!-- --></A><H3>
getImage</H3>
<PRE>
public java.lang.String <B>getImage</B>()</PRE>
<DL>
<DD>Get the filename that contains the image of the living being
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the image of the living being.</DL>
</DD>
</DL>
<HR>

<A NAME="getDisplayMechanism()"><!-- --></A><H3>
getDisplayMechanism</H3>
<PRE>
public java.lang.String <B>getDisplayMechanism</B>()</PRE>
<DL>
<DD>Get the preferred display mechanism for living being
<P>
<DD><DL>

<DT><B>Returns:</B><DD>one of the constants IMAGE or COLOR, 
 depending on the display mechanism for the living being.</DL>
</DD>
</DL>
<HR>

<A NAME="getMinEnergy()"><!-- --></A><H3>
getMinEnergy</H3>
<PRE>
protected int <B>getMinEnergy</B>()</PRE>
<DL>
<DD>Get the minimum energy needed to live.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the minimum energy needed for the living being to live.</DL>
</DD>
</DL>
<HR>

<A NAME="getMaxEnergy()"><!-- --></A><H3>
getMaxEnergy</H3>
<PRE>
protected int <B>getMaxEnergy</B>()</PRE>
<DL>
<DD>get the maximum energy that the living being can carry.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the maximum energy the living being can carry.</DL>
</DD>
</DL>
<HR>

<A NAME="getSpecies()"><!-- --></A><H3>
getSpecies</H3>
<PRE>
public java.lang.String <B>getSpecies</B>()</PRE>
<DL>
<DD>Returns the species.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the species</DL>
</DD>
</DL>
<HR>

<A NAME="getEnergy()"><!-- --></A><H3>
getEnergy</H3>
<PRE>
public int <B>getEnergy</B>()</PRE>
<DL>
<DD>Get the energy currently carried by the living being.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>current energy level of the organism</DL>
</DD>
</DL>
<HR>

<A NAME="setEnergy(int)"><!-- --></A><H3>
setEnergy</H3>
<PRE>
protected void <B>setEnergy</B>(int&nbsp;newEnergy)</PRE>
<DL>
<DD>Sets energy level.
 If new energy level is less than minimum energy level, the organism dies.
 New energy level is capped at maximum energy level.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="die()"><!-- --></A><H3>
die</H3>
<PRE>
protected void <B>die</B>()</PRE>
<DL>
<DD>Die: Change the deadOrAlive to DEAD.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="isDead()"><!-- --></A><H3>
isDead</H3>
<PRE>
public boolean <B>isDead</B>()</PRE>
<DL>
<DD>Is the living being dead?
<P>
<DD><DL>

<DT><B>Returns:</B><DD><code>true</code> if dead. <code>false</code>, otherwise.</DL>
</DD>
</DL>
<HR>

<A NAME="liveALittle()"><!-- --></A><H3>
liveALittle</H3>
<PRE>
public void <B>liveALittle</B>()</PRE>
<DL>
<DD>The living being's age increases by one time block.
<P>
<DD><DL>
</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="Crocodile.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="LivingBeing.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 + -