soc.game
Class SOCRoad

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

public class SOCRoad
extends SOCPlayingPiece

A road playing piece, or (on the large sea board) a ship playing piece.

To simplify some game code, ships are a subclass of roads. To see if this piece is actually a road, check isRoadNotShip().

See Also:
Serialized Form

Field Summary
 
Fields inherited from class soc.game.SOCPlayingPiece
board, CITY, coord, FORTRESS, MAXPLUSONE, MIN, pieceType, player, ROAD, SETTLEMENT, SHIP, specialVP, specialVPEvent, VILLAGE
 
Constructor Summary
SOCRoad(SOCPlayer pl, int co, SOCBoard board)
          Make a new road
 
Method Summary
 int[] getAdjacentNodes()
          The 2 nodes touching this road.
 boolean isRoadNotShip()
          Is this piece really a road on land, and not a ship on water (our subclass)?
 
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
 

Constructor Detail

SOCRoad

public SOCRoad(SOCPlayer pl,
               int co,
               SOCBoard board)
        throws java.lang.IllegalArgumentException
Make a new road

Parameters:
pl - player who owns the road
co - coordinates
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

getAdjacentNodes

public int[] getAdjacentNodes()
The 2 nodes touching this road.

Returns:
the 2 nodes touching this road, same format as SOCBoard.getAdjacentNodesToEdge_arr(int)

isRoadNotShip

public final boolean isRoadNotShip()
Is this piece really a road on land, and not a ship on water (our subclass)?

Returns:
True for roads (pieceType SOCPlayingPiece.ROAD), false otherwise
Since:
2.0.00