JSettlers v1.0.6 API
Built ${date}

soc.game
Class SOCPlayerNumbers

java.lang.Object
  extended bysoc.game.SOCPlayerNumbers

public class SOCPlayerNumbers
extends java.lang.Object

This class tracks what numbers a player's pieces are touching

Author:
Robert S. Thomas

Constructor Summary
SOCPlayerNumbers()
          the constructor
SOCPlayerNumbers(SOCPlayerNumbers numbers)
          make a copy of the player numbers
 
Method Summary
 void addNumberForResource(int number, int resource, int hex)
          set a number for a resource
 void clear()
          clear all of the data
 SOCPlayerNumbers copy()
          return a copy of this object
 java.util.Vector getNumberResourcePairsForHex(int hex)
           
 java.util.Vector getNumbersForResource(int resource)
           
 java.util.Vector getNumbersForResource(int resource, int robberHex)
           
 java.util.Vector getResourcesForNumber(int num)
           
 java.util.Vector getResourcesForNumber(int number, int robberHex)
           
 boolean hasNumber(int number)
          return true if this player is touching the requested number
 java.lang.String toString()
          return a human readable form of this object
 void undoAddNumberForResource(int number, int resource, int hex)
          remove a number for a resource do this when you take back a piece
 void undoUpdateNumbers(int coord, SOCBoard board)
          undo the updating of the numbers data given a coordinate and a board, remove numbers for this player from the list
 void undoUpdateNumbers(SOCPlayingPiece piece, SOCBoard board)
          undo the updating of the numbers data given a piece and a board, remove numbers for this player from the list
 void updateNumbers(int coord, SOCBoard board)
          update the numbers data given a coordinate and a board, add numbers for this player to the list
 void updateNumbers(SOCPlayingPiece piece, SOCBoard board)
          update the numbers data given a piece and a board, add numbers for this player to the list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SOCPlayerNumbers

public SOCPlayerNumbers(SOCPlayerNumbers numbers)
make a copy of the player numbers

Parameters:
numbers - the player numbers to copy

SOCPlayerNumbers

public SOCPlayerNumbers()
the constructor

Method Detail

clear

public void clear()
clear all of the data


updateNumbers

public void updateNumbers(SOCPlayingPiece piece,
                          SOCBoard board)
update the numbers data given a piece and a board, add numbers for this player to the list

Parameters:
piece - the playing piece
board - the game board

updateNumbers

public void updateNumbers(int coord,
                          SOCBoard board)
update the numbers data given a coordinate and a board, add numbers for this player to the list

Parameters:
coord - the coordinate
board - the game board

getResourcesForNumber

public java.util.Vector getResourcesForNumber(int num)
Parameters:
num - the number
Returns:
the resources for a number

getNumbersForResource

public java.util.Vector getNumbersForResource(int resource)
Parameters:
resource - the resource
Returns:
the numbers for a resource

getNumberResourcePairsForHex

public java.util.Vector getNumberResourcePairsForHex(int hex)
Parameters:
hex - the hex coord
Returns:
the number-resource pairs for a hex

getNumbersForResource

public java.util.Vector getNumbersForResource(int resource,
                                              int robberHex)
Parameters:
resource - the resource
robberHex - the robber hex
Returns:
the numbers for a resource taking the robber into account

getResourcesForNumber

public java.util.Vector getResourcesForNumber(int number,
                                              int robberHex)
Parameters:
number - the resource
robberHex - the robber hex
Returns:
the resources for a number taking the robber into account

addNumberForResource

public void addNumberForResource(int number,
                                 int resource,
                                 int hex)
set a number for a resource

Parameters:
number - the number
resource - the resource
hex - the hex

undoUpdateNumbers

public void undoUpdateNumbers(SOCPlayingPiece piece,
                              SOCBoard board)
undo the updating of the numbers data given a piece and a board, remove numbers for this player from the list

Parameters:
piece - the playing piece
board - the game board

undoUpdateNumbers

public void undoUpdateNumbers(int coord,
                              SOCBoard board)
undo the updating of the numbers data given a coordinate and a board, remove numbers for this player from the list

Parameters:
coord - the coordinate
board - the game board

undoAddNumberForResource

public void undoAddNumberForResource(int number,
                                     int resource,
                                     int hex)
remove a number for a resource do this when you take back a piece

Parameters:
number - the number
resource - the resource
hex - the hex

hasNumber

public boolean hasNumber(int number)
return true if this player is touching the requested number

Parameters:
number - the number
Returns:
true if the player has the number

copy

public SOCPlayerNumbers copy()
return a copy of this object


toString

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


JSettlers v1.0.6 API
Built ${date}