org.cb.jset.client.model
Class JSetClientBoardModel

java.lang.Object
  extended byorg.cb.cardboard.AbstractCardBoardModel
      extended byorg.cb.jset.client.model.JSetClientBoardModel
All Implemented Interfaces:
CardBoardModel, java.io.Serializable, SetGameClientBoard

public class JSetClientBoardModel
extends AbstractCardBoardModel
implements SetGameClientBoard, java.io.Serializable

A client BoardImpl is a special board that also keeps track of card layout, especially the empty spaces. Note: implementation not yet multithread safe (FIXME)

Version:
$Id: JSetClientBoardModel.java 129 2004-04-15 05:00:43Z jerome $
Author:
jerome@coffeebreaks.org - last modified by $LastChangedBy: jerome $
See Also:
Serialized Form

Constructor Summary
JSetClientBoardModel()
           
 
Method Summary
 void addCards(CardProperties[] cards)
          Add the specified cards onto the board.
 void clear()
          Clear the board.
 Card getElementAt(int index)
          Return the Card element specified by the index on the board.
 java.util.List getElements()
           
 int getNbCards()
           
 int getSize()
          Returns the number of cards on the board.
 void removeSet(CardSet set)
          Remove the specified matching set from the board.
 
Methods inherited from class org.cb.cardboard.AbstractCardBoardModel
addBoardDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, removeBoardDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSetClientBoardModel

public JSetClientBoardModel()
Method Detail

clear

public void clear()
Clear the board.


getSize

public int getSize()
Description copied from interface: CardBoardModel
Returns the number of cards on the board.

Specified by:
getSize in interface CardBoardModel
Returns:
the number of spaces used by cards on the board. Unused spaces are taken into account.
See Also:
for the exact number of cards on the board.

getElementAt

public Card getElementAt(int index)
Return the Card element specified by the index on the board.

Specified by:
getElementAt in interface CardBoardModel
Parameters:
index -
Returns:
the Card element or null if the space on the board is empty at that position.

getElements

public java.util.List getElements()
Specified by:
getElements in interface CardBoardModel
Returns:
The cards in the board. May contain some null to represent the empty spaces.

getNbCards

public int getNbCards()
Specified by:
getNbCards in interface SetGameClientBoard
Returns:
the number of cards on the board.
See Also:
which takes into account the number of cards plus the empty spaces.

addCards

public void addCards(CardProperties[] cards)
Add the specified cards onto the board.

Specified by:
addCards in interface SetGameClientBoard
Parameters:
cards - the cards to add.
Throws:
java.lang.NullPointerException - if cards is null or if an element in the array is null.

removeSet

public void removeSet(CardSet set)
               throws BoardException
Remove the specified matching set from the board.

Specified by:
removeSet in interface SetGameClientBoard
Parameters:
set - the set to remove
Throws:
BoardException - when something fails


Copyright © 2004 CoffeeBreaks. All Rights Reserved.