JSettlers v1.0.6 API
Built ${date}

soc.robot
Class SOCPossiblePiece

java.lang.Object
  extended bysoc.robot.SOCPossiblePiece
Direct Known Subclasses:
SOCPossibleCard, SOCPossibleCity, SOCPossibleRoad, SOCPossibleSettlement

public abstract class SOCPossiblePiece
extends java.lang.Object

Pieces that a player might build

Author:
Robert S. Thomas

Field Summary
protected  java.util.Vector biggestThreats
          this is the piece that we need to beat to build this one
static int CARD
           
static int CITY
           
protected  int coord
          Where this piece is on the board
protected  int eta
          this is how soon we estimate we can build this piece measured in turns
protected  boolean hasBeenExpanded
          this flag is used for expansion
static int MAXPLUSONE
           
static int MIN
           
protected  int pieceType
          The type of this playing piece
protected  SOCPlayer player
          The player who owns this piece
static int ROAD
          Types of playing pieces
protected  float score
          this is a score used for deciding what to build next
static int SETTLEMENT
           
protected  java.util.Vector threats
          pieces that threaten this piece
protected  boolean threatUpdatedFlag
          this flag is used for threat updating
protected  boolean updated
          this is a flag used for updating
 
Constructor Summary
SOCPossiblePiece()
           
 
Method Summary
 void addBiggestThreat(SOCPossiblePiece bt)
          set the biggest threat
 void addThreat(SOCPossiblePiece piece)
          add a threat to the list
 void addToScore(float amt)
          add to score
 void clearBiggestThreats()
          reset the biggest threat
 void clearThreats()
          clear the list of threats
 void clearUpdateFlag()
          clear the update flag
 java.util.Vector getBiggestThreats()
           
 int getCoordinates()
           
 int getETA()
           
 SOCPlayer getPlayer()
           
 float getScore()
           
 java.util.Vector getThreats()
           
 int getType()
           
 boolean hasBeenExpanded()
           
 boolean isETAUpdated()
           
 boolean isThreatUpdated()
           
 void resetExpandedFlag()
          set hasBeenExpanded to false
 void resetScore()
          reset the score
 void setETA(int e)
          update the eta for this piece
 void setExpandedFlag()
          set hasBeenExpanded to true
 void subtractFromScore(float amt)
          subtract from score
 void threatUpdated()
          mark this piece as having been threat updated
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ROAD

public static final int ROAD
Types of playing pieces

See Also:
Constant Field Values

SETTLEMENT

public static final int SETTLEMENT
See Also:
Constant Field Values

CITY

public static final int CITY
See Also:
Constant Field Values

CARD

public static final int CARD
See Also:
Constant Field Values

MIN

public static final int MIN
See Also:
Constant Field Values

MAXPLUSONE

public static final int MAXPLUSONE
See Also:
Constant Field Values

pieceType

protected int pieceType
The type of this playing piece


player

protected SOCPlayer player
The player who owns this piece


coord

protected int coord
Where this piece is on the board


eta

protected int eta
this is how soon we estimate we can build this piece measured in turns


updated

protected boolean updated
this is a flag used for updating


score

protected float score
this is a score used for deciding what to build next


biggestThreats

protected java.util.Vector biggestThreats
this is the piece that we need to beat to build this one


threats

protected java.util.Vector threats
pieces that threaten this piece


threatUpdatedFlag

protected boolean threatUpdatedFlag
this flag is used for threat updating


hasBeenExpanded

protected boolean hasBeenExpanded
this flag is used for expansion

Constructor Detail

SOCPossiblePiece

public SOCPossiblePiece()
Method Detail

getType

public int getType()
Returns:
the type of piece

getPlayer

public SOCPlayer getPlayer()
Returns:
the owner of the piece

getCoordinates

public int getCoordinates()
Returns:
the coordinates for this piece

getETA

public int getETA()
Returns:
the eta for this piece

setETA

public void setETA(int e)
update the eta for this piece

Parameters:
e - the new eta

isETAUpdated

public boolean isETAUpdated()
Returns:
the value of the ETA update flag

clearUpdateFlag

public void clearUpdateFlag()
clear the update flag


resetScore

public void resetScore()
reset the score


addToScore

public void addToScore(float amt)
add to score

Parameters:
amt - the amount to add

subtractFromScore

public void subtractFromScore(float amt)
subtract from score

Parameters:
amt - the amount to subtract

getScore

public float getScore()
Returns:
the score

clearBiggestThreats

public void clearBiggestThreats()
reset the biggest threat


addBiggestThreat

public void addBiggestThreat(SOCPossiblePiece bt)
set the biggest threat

Parameters:
bt - the threat

getBiggestThreats

public java.util.Vector getBiggestThreats()
Returns:
the biggest threat

getThreats

public java.util.Vector getThreats()
Returns:
the list of threats

addThreat

public void addThreat(SOCPossiblePiece piece)
add a threat to the list

Parameters:
piece -

isThreatUpdated

public boolean isThreatUpdated()
Returns:
the status of the threatUpdatedFlag

clearThreats

public void clearThreats()
clear the list of threats


threatUpdated

public void threatUpdated()
mark this piece as having been threat updated


hasBeenExpanded

public boolean hasBeenExpanded()
Returns:
the status of the hasBeenExpanded flag

resetExpandedFlag

public void resetExpandedFlag()
set hasBeenExpanded to false


setExpandedFlag

public void setExpandedFlag()
set hasBeenExpanded to true


toString

public java.lang.String toString()
Returns:
a human readable form of this object

JSettlers v1.0.6 API
Built ${date}