soc.robot
Class SOCPossibleRoad

java.lang.Object
  extended by soc.robot.SOCPossiblePiece
      extended by soc.robot.SOCPossibleRoad
Direct Known Subclasses:
SOCPossibleShip

public class SOCPossibleRoad
extends SOCPossiblePiece

This is a possible road that we can build. Note that SOCPossibleShip is a subclass.

Author:
Robert S Thomas

Field Summary
protected  int longestRoadPotential
           
protected  int longestRoadValue
           
protected  java.util.Vector<SOCPossibleRoad> necessaryRoads
           
protected  java.util.Vector<SOCPossiblePiece> newPossibilities
           
protected  int numberOfNecessaryRoads
           
 
Fields inherited from class soc.robot.SOCPossiblePiece
biggestThreats, CARD, CITY, coord, eta, hasBeenExpanded, MAXPLUSONE, MIN, PICK_SPECIAL, pieceType, player, ROAD, score, SETTLEMENT, SHIP, threats, threatUpdatedFlag, updated
 
Constructor Summary
SOCPossibleRoad(SOCPlayer pl, int co, java.util.Vector<SOCPossibleRoad> nr)
          constructor
SOCPossibleRoad(SOCPossibleRoad pr)
          copy constructor Note: This will not copy the vectors, just make empty ones
 
Method Summary
 void addNecessaryRoad(SOCPossibleRoad rd)
          add a possible road to the list of necessary roads
 void addNewPossibility(SOCPossiblePiece piece)
          add a new possibility to the list
 int getLRPotential()
           
 int getLRValue()
           
 java.util.Vector<SOCPossibleRoad> getNecessaryRoads()
          Get this possible road/ship's list of necessary roads, from constructor and/or addNecessaryRoad(SOCPossibleRoad).
 java.util.Vector<SOCPossiblePiece> getNewPossibilities()
          Get the list of any possibilities added by addNewPossibility(SOCPossiblePiece).
 int getNumberOfNecessaryRoads()
          Get the minimum number of necessary roads and/or ships.
 boolean isRoadNotShip()
          Is this piece really a road on land, and not a ship on water (our subclass)?
 void setLRPotential(int value)
          set the longest road potential
 void setLRValue(int value)
          set the longest road value
 void setNumberOfNecessaryRoads(int num)
          Set the minimum number of necessary roads and/or ships.
 
Methods inherited from class soc.robot.SOCPossiblePiece
addBiggestThreat, addThreat, addToScore, clearBiggestThreats, clearThreats, clearUpdateFlag, getBiggestThreats, getCoordinates, getETA, getPlayer, getResourcesToBuild, getScore, getThreats, getType, hasBeenExpanded, isETAUpdated, isThreatUpdated, resetExpandedFlag, resetScore, setETA, setExpandedFlag, subtractFromScore, threatUpdated, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

necessaryRoads

protected java.util.Vector<SOCPossibleRoad> necessaryRoads

newPossibilities

protected java.util.Vector<SOCPossiblePiece> newPossibilities

longestRoadValue

protected int longestRoadValue

longestRoadPotential

protected int longestRoadPotential

numberOfNecessaryRoads

protected int numberOfNecessaryRoads
Constructor Detail

SOCPossibleRoad

public SOCPossibleRoad(SOCPlayer pl,
                       int co,
                       java.util.Vector<SOCPossibleRoad> nr)
constructor

Parameters:
pl - the owner
co - coordinates
nr - necessaryRoads, or null to create a new empty Vector here

SOCPossibleRoad

public SOCPossibleRoad(SOCPossibleRoad pr)
copy constructor Note: This will not copy the vectors, just make empty ones

Parameters:
pr - the possible road to copy
Method Detail

getNecessaryRoads

public java.util.Vector<SOCPossibleRoad> getNecessaryRoads()
Get this possible road/ship's list of necessary roads, from constructor and/or addNecessaryRoad(SOCPossibleRoad).

Returns:
the list of necessary roads or ships

getNumberOfNecessaryRoads

public int getNumberOfNecessaryRoads()
Get the minimum number of necessary roads and/or ships. Note that for routes with both roads and ships, this will be +2 for every coastal-settlement transition between roads and ships, for the effort of building the settlement.

Returns:
the minimum number of necessary roads or ships

setNumberOfNecessaryRoads

public void setNumberOfNecessaryRoads(int num)
Set the minimum number of necessary roads and/or ships. Note that for routes with both roads and ships, this will be +2 for every coastal-settlement transition between roads and ships, for the effort of building the settlement.

Parameters:
num - the minimum number of necessary roads

getNewPossibilities

public java.util.Vector<SOCPossiblePiece> getNewPossibilities()
Get the list of any possibilities added by addNewPossibility(SOCPossiblePiece).

Returns:
the list of new possibilities

getLRValue

public int getLRValue()
Returns:
the longestRoadValue

getLRPotential

public int getLRPotential()
Returns:
the longestRoadPotential

addNecessaryRoad

public void addNecessaryRoad(SOCPossibleRoad rd)
add a possible road to the list of necessary roads

Parameters:
rd - the road

addNewPossibility

public void addNewPossibility(SOCPossiblePiece piece)
add a new possibility to the list

Parameters:
piece - the new possible piece

setLRValue

public void setLRValue(int value)
set the longest road value

Parameters:
value -

setLRPotential

public void setLRPotential(int value)
set the longest road potential

Parameters:
value -

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