soc.game
Class SOCDevCardSet

java.lang.Object
  extended bysoc.game.SOCDevCardSet
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class SOCDevCardSet
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

This represents a collection of development cards

See Also:
Serialized Form

Field Summary
private  int[][] devCards
          the number of development cards [OLD] are the old cards [NEW] are recently bought cards
static int NEW
           
static int OLD
          age constants
 
Constructor Summary
SOCDevCardSet()
          Make an empty development card set
SOCDevCardSet(SOCDevCardSet set)
          Make a copy of a dev card set
 
Method Summary
 void add(int amt, int age, int ctype)
          add an amount to a type of card
 void clear()
          set the number of old and new dev cards to zero
 int getAmount(int age, int ctype)
           
 int getNumUnplayed()
          Some card types stay in your hand after being played.
 int getNumVPCards()
           
 int getTotal()
           
 void newToOld()
          change all the new cards to old ones
 void setAmount(int amt, int age, int ctype)
          set the amount of a type of card
 void subtract(int amt, int age, int ctype)
          subtract an amount from a type of card
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OLD

public static final int OLD
age constants

See Also:
Constant Field Values

NEW

public static final int NEW
See Also:
Constant Field Values

devCards

private int[][] devCards
the number of development cards [OLD] are the old cards [NEW] are recently bought cards

Constructor Detail

SOCDevCardSet

public SOCDevCardSet()
Make an empty development card set


SOCDevCardSet

public SOCDevCardSet(SOCDevCardSet set)
Make a copy of a dev card set

Parameters:
set - the dev card set to copy
Method Detail

clear

public void clear()
set the number of old and new dev cards to zero


getAmount

public int getAmount(int age,
                     int ctype)
Parameters:
age - either OLD or NEW
ctype - the type of development card as described in SOCDevCardConstants
Returns:
the number of a kind of development card

getTotal

public int getTotal()
Returns:
the total number of development cards

setAmount

public void setAmount(int amt,
                      int age,
                      int ctype)
set the amount of a type of card

Parameters:
age - either OLD or NEW
ctype - the type of development card
amt - the amount

add

public void add(int amt,
                int age,
                int ctype)
add an amount to a type of card

Parameters:
age - either OLD or NEW
ctype - the type of development card
amt - the amount

subtract

public void subtract(int amt,
                     int age,
                     int ctype)
subtract an amount from a type of card

Parameters:
age - either OLD or NEW
ctype - the type of development card
amt - the amount

getNumVPCards

public int getNumVPCards()
Returns:
the number of victory point cards in this set

getNumUnplayed

public int getNumUnplayed()
Some card types stay in your hand after being played. Count only the unplayed ones (old or new).

Returns:
the number of unplayed cards in this set

newToOld

public void newToOld()
change all the new cards to old ones