public final class FieldCellImpl extends java.lang.Object implements FieldCell
FieldCell
.Constructor and Description |
---|
FieldCellImpl() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
java.util.Optional<Ship> |
getShip()
Returns an Optional of Ship.
|
int |
hashCode() |
boolean |
isEmpty()
Returns
true if this field cell is empty. |
boolean |
isHit()
Returns
true if a Ship is hit. |
boolean |
isMissed()
Returns
true if the field cell was hit but it was empty. |
boolean |
isPresent()
Returns
true if a Ship is present, false otherwise. |
void |
placeShip(Ship ship)
Places a ship in the field cell.
|
void |
shoot(Shot shot)
Tries to shoot this field cell.
|
java.lang.String |
toString() |
public void placeShip(Ship ship)
FieldCell
public void shoot(Shot shot)
FieldCell
public boolean isEmpty()
FieldCell
true
if this field cell is empty.public boolean isHit()
FieldCell
true
if a Ship
is hit.public boolean isMissed()
FieldCell
true
if the field cell was hit but it was empty.public boolean isPresent()
FieldCell
true
if a Ship
is present, false otherwise.public java.util.Optional<Ship> getShip()
FieldCell
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object