|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Ship
Ship is an interface that all of your ship classes must implement.
| Field Summary | |
|---|---|
static int |
EAST
|
static int |
NORTH
|
static int |
SOUTH
|
static int |
WEST
|
| Method Summary | |
|---|---|
char |
getCharForPoint(BoardPoint strike)
Returns the character to display for a given BoardPoint. |
BoardPoint[] |
getExtent()
Returns a newly-allocated array of BoardPoints, one for each BoardPoint this Ship occupies. |
int |
getFacing()
Returns the direction this Ship is facing. |
java.lang.String |
getName()
Returns a human-readable name for this Ship, such as "aircraft carrier." |
BoardPoint |
getOrigin()
Returns the origin point for this Ship. |
boolean |
isDestroyed()
Returns true if this Ship is destroyed, false otherwise. |
boolean |
occupies(BoardPoint strike)
Returns true if this Ship occupies the given space, false otherwise. |
void |
registerStrike(BoardPoint strike)
Registers the result of a strike at the given point; records the strike and possibly destroys the ship. |
void |
setFacing(int facing)
Sets the direction this ship is facing. |
void |
setOrigin(BoardPoint origin)
Sets the origin of this ship as a BoardPoint. |
| Field Detail |
|---|
static final int NORTH
static final int EAST
static final int SOUTH
static final int WEST
| Method Detail |
|---|
boolean isDestroyed()
java.lang.String getName()
boolean occupies(BoardPoint strike)
strike - a BoardSpace that this Ship may or may not occupy
void registerStrike(BoardPoint strike)
strike - a BoardSpaceBoardPoint getOrigin()
int getFacing()
BoardPoint[] getExtent()
char getCharForPoint(BoardPoint strike)
strike -
void setOrigin(BoardPoint origin)
origin - void setFacing(int facing)
facing - the direction this ship is facing.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||