📄 ship.html
字号:
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Field Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="name"><!-- --></A><H3>
name</H3>
<PRE>
private <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>name</B></PRE>
<DL>
<DD>Name of the ship
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="length"><!-- --></A><H3>
length</H3>
<PRE>
private int <B>length</B></PRE>
<DL>
<DD>Number of holes this ship occupies
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="body"><!-- --></A><H3>
body</H3>
<PRE>
private <A HREF="Location.html" title="class in ">Location</A>[] <B>body</B></PRE>
<DL>
<DD>Location of the body parts : an array 0..length-1
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="hit"><!-- --></A><H3>
hit</H3>
<PRE>
private int[] <B>hit</B></PRE>
<DL>
<DD>Indices of the body parts destroyed
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="hitNumber"><!-- --></A><H3>
hitNumber</H3>
<PRE>
private int <B>hitNumber</B></PRE>
<DL>
<DD>Number of body parts destroyed
<P>
<DL>
</DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="Ship(java.lang.String, int, Location, int)"><!-- --></A><H3>
Ship</H3>
<PRE>
<B>Ship</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> n, int l, <A HREF="Location.html" title="class in ">Location</A> end, int dir)</PRE>
<DL>
<DD>Creates a ship, and places it in a specified place.
<P>
<DT><B>Parameters:</B><DD><CODE>n</CODE> - Ship's name<DD><CODE>l</CODE> - Ship's length<DD><CODE>end</CODE> - Location of Ship's top, left end point<DD><CODE>dir</CODE> - Direction to place the Ship (1=vertical, 0=horizontal)</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="length()"><!-- --></A><H3>
length</H3>
<PRE>
public int <B>length</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Returns:</B><DD>Length of this ship</DL>
</DD>
</DL>
<HR>
<A NAME="locPart(int)"><!-- --></A><H3>
locPart</H3>
<PRE>
public <A HREF="Location.html" title="class in ">Location</A> <B>locPart</B>(int i)</PRE>
<DL>
<DD>Get Location of specified body part
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>i</CODE> - index of body part required<DT><B>Returns:</B><DD>Location of body part i</DL>
</DD>
</DL>
<HR>
<A NAME="detail()"><!-- --></A><H3>
detail</H3>
<PRE>
public <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>detail</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Returns:</B><DD>name and length of Ship, as a string</DL>
</DD>
</DL>
<HR>
<A NAME="isSunk()"><!-- --></A><H3>
isSunk</H3>
<PRE>
public boolean <B>isSunk</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Returns:</B><DD>True if all body parts are hit</DL>
</DD>
</DL>
<HR>
<A NAME="numHit()"><!-- --></A><H3>
numHit</H3>
<PRE>
public int <B>numHit</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Returns:</B><DD>number of body parts hit</DL>
</DD>
</DL>
<HR>
<A NAME="hit(int)"><!-- --></A><H3>
hit</H3>
<PRE>
private void <B>hit</B>(int i)</PRE>
<DL>
<DD>Marks body part i, as hit
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>i</CODE> - number of body part to be destroyed</DL>
</DD>
</DL>
<HR>
<A NAME="guess(Location)"><!-- --></A><H3>
guess</H3>
<PRE>
public boolean <B>guess</B>(<A HREF="Location.html" title="class in ">Location</A> l)</PRE>
<DL>
<DD>Carries out opponent's guess.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>l</CODE> - Location guessed<DT><B>Returns:</B><DD>true if this ship occupies location l</DL>
</DD>
</DL>
<HR>
<A NAME="isClash(Ship)"><!-- --></A><H3>
isClash</H3>
<PRE>
public boolean <B>isClash</B>(<A HREF="Ship.html" title="class in ">Ship</A> s)</PRE>
<DL>
<DD>Checks if two ships are in the same hole
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - Ship to compare with<DT><B>Returns:</B><DD>true if this ship and s have a common hole</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT> </TD>
</TD>
<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="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</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>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="Location.html" title="class in "><B>PREV CLASS</B></A>
<A HREF="ShipBoard.html" title="class in "><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="Ship.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <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>
<A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -