VASSAL.counters
Class Deck

java.lang.Object
  |
  +--VASSAL.counters.Stack
        |
        +--VASSAL.counters.Deck
All Implemented Interfaces:
GamePiece

public class Deck
extends Stack

A collection of pieces that behaves like a deck, i.e.: Doesn't move. Can't be expanded. Can be shuffled. Can be turned face-up and face-down


Field Summary
static java.lang.String ALWAYS
           
protected  int dragCount
           
static java.lang.String ID
           
static java.lang.String NEVER
           
protected  boolean shuffle
           
protected  java.awt.Dimension size
           
static java.lang.String USE_MENU
           
 
Fields inherited from class VASSAL.counters.Stack
contents, INCR, map, pieceCount, pos, TYPE
 
Constructor Summary
Deck()
           
Deck(java.lang.String type)
           
 
Method Summary
 java.awt.Rectangle boundingBox()
          The area which this GamePiece occupies when drawn at the point (0,0)
 void draw(java.awt.Graphics g, int x, int y, java.awt.Component obs, double zoom)
          If the obs parameter is a Map, delegate drawing of this Stack to the StackMetrics of that Map.
 PieceIterator drawCards()
          Return an iterator of pieces to be drawn from the Deck.
protected  java.awt.Color getBlankColor()
          The color used to draw boxes representing cards underneath the top one.
 java.lang.String getDeckName()
           
 java.lang.String getFaceDownMsgFormat()
           
 java.lang.String getFaceDownOption()
           
 java.awt.Color getOutlineColor()
           
 java.lang.Object getProperty(java.lang.Object key)
           
 java.lang.String getReshuffleCommand()
          The popup menu text for the command that sends the entire deck to another deck
 java.lang.String getReshuffleMsgFormat()
          The message to send to the chat window when the deck is reshuffled to another deck
 java.lang.String getReshuffleTarget()
          The name of the DrawPile to which the contents of this deck will be sent when the reshuffle command is selected
 java.lang.String getReverseMsgFormat()
           
 java.awt.Shape getShape()
          The shape of the piece from the user's viewpoint.
 java.lang.String getShuffleMsgFormat()
           
 java.lang.String getShuffleOption()
           
 java.awt.Dimension getSize()
           
 java.lang.String getState()
          The state information is information that can change during the course of a game.
 java.lang.String getType()
          The type information is information that does not change during the course of a game.
 boolean isAllowMultipleDraw()
           
 boolean isAllowSelectDraw()
           
 boolean isDrawOutline()
           
 boolean isExpanded()
           
 boolean isFaceDown()
           
 boolean isReversible()
           
 boolean isShuffle()
           
protected  void mySetType(java.lang.String type)
           
 void promptForDragCount()
           
 Command reverse()
          Reverse the order of the contents of the Deck
 Command sendToDeck()
          Combine the contents of this Deck with the contents of the deck specified by #reshuffleTarget
 void setAllowMultipleDraw(boolean allowMultipleDraw)
           
 void setAllowSelectDraw(boolean allowSelectDraw)
           
protected  Command setContents(java.util.Iterator it)
          Set the contents of this Deck to an Enumeration of GamePieces
 Command setContentsFaceDown(boolean value)
           
 void setDeckName(java.lang.String n)
           
 void setDrawOutline(boolean drawOutline)
           
 void setFaceDown(boolean faceDown)
           
 void setFaceDownMsgFormat(java.lang.String faceDownMsgFormat)
           
 void setFaceDownOption(java.lang.String faceDownOption)
           
 void setOutlineColor(java.awt.Color outlineColor)
           
 void setReshuffleCommand(java.lang.String reshuffleCommand)
           
 void setReshuffleMsgFormat(java.lang.String reshuffleMsgFormat)
           
 void setReshuffleTarget(java.lang.String reshuffleTarget)
           
 void setReverseMsgFormat(java.lang.String reverseMsgFormat)
           
 void setReversible(boolean reversible)
           
 void setShuffle(boolean shuffle)
           
 void setShuffleMsgFormat(java.lang.String shuffleMsgFormat)
           
 void setShuffleOption(java.lang.String shuffleOption)
           
 void setSize(java.awt.Dimension size)
           
 void setState(java.lang.String state)
           
 Command shuffle()
          Shuffle the contents of the Deck
 
Methods inherited from class VASSAL.counters.Stack
add, bottomPiece, getDefaultMetrics, getId, getMap, getName, getParent, getPieceAt, getPieceCount, getPieces, getPiecesInReverseOrder, getPiecesInVisibleOrder, getPosition, indexOf, insert, insertChild, insertPieceAt, keyEvent, mergeState, nVisible, remove, removeAll, selectNext, setDefaultMetrics, setExpanded, setId, setMap, setParent, setPosition, setProperty, topPiece
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final java.lang.String ID

ALWAYS

public static final java.lang.String ALWAYS

NEVER

public static final java.lang.String NEVER

USE_MENU

public static final java.lang.String USE_MENU

size

protected java.awt.Dimension size

shuffle

protected boolean shuffle

dragCount

protected int dragCount
Constructor Detail

Deck

public Deck()

Deck

public Deck(java.lang.String type)
Method Detail

mySetType

protected void mySetType(java.lang.String type)

getFaceDownOption

public java.lang.String getFaceDownOption()

setFaceDownOption

public void setFaceDownOption(java.lang.String faceDownOption)

getSize

public java.awt.Dimension getSize()

setSize

public void setSize(java.awt.Dimension size)

getShuffleOption

public java.lang.String getShuffleOption()

setShuffleOption

public void setShuffleOption(java.lang.String shuffleOption)

isShuffle

public boolean isShuffle()

getFaceDownMsgFormat

public java.lang.String getFaceDownMsgFormat()

setFaceDownMsgFormat

public void setFaceDownMsgFormat(java.lang.String faceDownMsgFormat)

getReverseMsgFormat

public java.lang.String getReverseMsgFormat()

setReverseMsgFormat

public void setReverseMsgFormat(java.lang.String reverseMsgFormat)

getShuffleMsgFormat

public java.lang.String getShuffleMsgFormat()

setShuffleMsgFormat

public void setShuffleMsgFormat(java.lang.String shuffleMsgFormat)

setShuffle

public void setShuffle(boolean shuffle)

isAllowMultipleDraw

public boolean isAllowMultipleDraw()

setAllowMultipleDraw

public void setAllowMultipleDraw(boolean allowMultipleDraw)

isAllowSelectDraw

public boolean isAllowSelectDraw()

setAllowSelectDraw

public void setAllowSelectDraw(boolean allowSelectDraw)

isReversible

public boolean isReversible()

setReversible

public void setReversible(boolean reversible)

setDeckName

public void setDeckName(java.lang.String n)

getDeckName

public java.lang.String getDeckName()

getReshuffleCommand

public java.lang.String getReshuffleCommand()
The popup menu text for the command that sends the entire deck to another deck
Returns:
 

setReshuffleCommand

public void setReshuffleCommand(java.lang.String reshuffleCommand)

getReshuffleTarget

public java.lang.String getReshuffleTarget()
The name of the DrawPile to which the contents of this deck will be sent when the reshuffle command is selected

setReshuffleTarget

public void setReshuffleTarget(java.lang.String reshuffleTarget)

getReshuffleMsgFormat

public java.lang.String getReshuffleMsgFormat()
The message to send to the chat window when the deck is reshuffled to another deck
Returns:
 

setReshuffleMsgFormat

public void setReshuffleMsgFormat(java.lang.String reshuffleMsgFormat)

getType

public java.lang.String getType()
Description copied from interface: GamePiece
The type information is information that does not change during the course of a game. Image file names, popup menu command names, etc., all should be reflected in the type.
Overrides:
getType in class Stack
Following copied from interface: VASSAL.counters.GamePiece
See Also:
BasicCommandEncoder

shuffle

public Command shuffle()
Shuffle the contents of the Deck

drawCards

public PieceIterator drawCards()
Return an iterator of pieces to be drawn from the Deck. Normally, a random piece will be drawn, but if the Deck supports it, the user may have specified a particular set of pieces or a fixed number of pieces to select with the next draw.

setContents

protected Command setContents(java.util.Iterator it)
Set the contents of this Deck to an Enumeration of GamePieces

getState

public java.lang.String getState()
Description copied from interface: GamePiece
The state information is information that can change during the course of a game. State information is saved when the game is saved and is transferred between players on the server. For example, the relative order of pieces in a stack is state information, but whether the stack is expanded is not
Overrides:
getState in class Stack

setState

public void setState(java.lang.String state)
Overrides:
setState in class Stack

setContentsFaceDown

public Command setContentsFaceDown(boolean value)

reverse

public Command reverse()
Reverse the order of the contents of the Deck

isDrawOutline

public boolean isDrawOutline()

setOutlineColor

public void setOutlineColor(java.awt.Color outlineColor)

setDrawOutline

public void setDrawOutline(boolean drawOutline)

getOutlineColor

public java.awt.Color getOutlineColor()

isFaceDown

public boolean isFaceDown()

setFaceDown

public void setFaceDown(boolean faceDown)

draw

public void draw(java.awt.Graphics g,
                 int x,
                 int y,
                 java.awt.Component obs,
                 double zoom)
Description copied from class: Stack
If the obs parameter is a Map, delegate drawing of this Stack to the StackMetrics of that Map. If obs is not a Map, use the default StackMetrics
Overrides:
draw in class Stack
Following copied from class: VASSAL.counters.Stack
See Also:
StackMetrics.draw(VASSAL.counters.Stack, java.awt.Graphics, int, int, java.awt.Component, double), Stack.getDefaultMetrics()

getBlankColor

protected java.awt.Color getBlankColor()
The color used to draw boxes representing cards underneath the top one. If null, then draw each card normally for face-up decks, and duplicate the top card for face-down decks
Returns:
 

boundingBox

public java.awt.Rectangle boundingBox()
Description copied from interface: GamePiece
The area which this GamePiece occupies when drawn at the point (0,0)
Overrides:
boundingBox in class Stack

getShape

public java.awt.Shape getShape()
Description copied from interface: GamePiece
The shape of the piece from the user's viewpoint. This defines the area in which the user must click to select or move the piece, for example. Like GamePiece.boundingBox(), it assumes the position is (0,0) and must be translated to the actual location where the piece is being drawn.
Overrides:
getShape in class Stack

getProperty

public java.lang.Object getProperty(java.lang.Object key)
Overrides:
getProperty in class Stack

promptForDragCount

public void promptForDragCount()

sendToDeck

public Command sendToDeck()
Combine the contents of this Deck with the contents of the deck specified by #reshuffleTarget

isExpanded

public boolean isExpanded()
Overrides:
isExpanded in class Stack