soc.game
Class SOCShip

java.lang.Object
  extended by soc.game.SOCPlayingPiece
      extended by soc.game.SOCRoad
          extended by soc.game.SOCShip
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class SOCShip
extends SOCRoad

A ship playing piece, on the large sea board (SOCBoardLarge). To simplify some game code, ships are a subclass of roads.

Ships are open until their route has a settlement or city on both ends. Ships can be moved any turn after the turn they're placed, until isClosed() is true.

In scenario option _SC_PIRI, SOCShip has no "isWarship" field: Ships are converted to warships in the chronological order they're placed; see SOCGame.isShipWarship(SOCShip).

Since:
2.0.00
Author:
Jeremy D Monin <jeremy@nand.net>
See Also:
Serialized Form

Field Summary
private  boolean isClosed
          Is this ship part of an closed trade route, not an open one?
private static long serialVersionUID
           
 
Fields inherited from class soc.game.SOCPlayingPiece
board, CITY, coord, FORTRESS, MAXPLUSONE, MIN, pieceType, player, ROAD, SETTLEMENT, SHIP, specialVP, specialVPEvent, VILLAGE
 
Constructor Summary
SOCShip(SOCPlayer pl, int edge, SOCBoard board)
          Make a new ship.
 
Method Summary
 boolean isClosed()
          Is this ship part of a closed trade route, not an open one?
 void setClosed()
          Call when this ship's trade route has been closed.
 
Methods inherited from class soc.game.SOCRoad
getAdjacentNodes, isRoadNotShip
 
Methods inherited from class soc.game.SOCPlayingPiece
equals, getAdjacentEdges, getCoordinates, getPlayer, getPlayerNumber, getResourcesToBuild, getType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

isClosed

private boolean isClosed
Is this ship part of an closed trade route, not an open one?

Constructor Detail

SOCShip

public SOCShip(SOCPlayer pl,
               int edge,
               SOCBoard board)
        throws java.lang.IllegalArgumentException
Make a new ship. The ship is considered part of an open trade route, until setClosed() is called.

Parameters:
pl - player who owns the ship
edge - edge coordinate
board - board if known; otherwise will extract from pl
Throws:
java.lang.IllegalArgumentException - if pl null, or board null and pl.board also null
Method Detail

isClosed

public boolean isClosed()
Is this ship part of a closed trade route, not an open one?

Returns:
True if setClosed() has been called

setClosed

public void setClosed()
Call when this ship's trade route has been closed.