net.mlw.gfw.ext.card
Class DefaultHandModel

java.lang.Object
  |
  +--net.mlw.gfw.ext.card.DefaultHandModel
All Implemented Interfaces:
EventHandler, EventHandlerContainer, HandModel

public class DefaultHandModel
extends java.lang.Object
implements HandModel

Version:
$Revision: 1.6 $ $Date: 2004/06/29 20:32:54 $
Author:
Matthew L. Wilson

Field Summary
protected  net.mlw.gfw.ext.card.Card[] cards
           
protected  net.mlw.gfw.event.EventHandlerList eventHandlers
           
protected  int size
           
 
Constructor Summary
DefaultHandModel(int size)
           
 
Method Summary
 void addCard(net.mlw.gfw.ext.card.Card card)
          Add a Card to the hand.
 net.mlw.gfw.event.EventHandler addEventHandler(net.mlw.gfw.event.EventHandler eventHandler)
          Adds a EventHandler to the internal List of EventHandlers.
 void fireChange()
          (non-Javadoc)
 net.mlw.gfw.ext.card.Card getCard(int index)
          Peek at a card in the hand.
 net.mlw.gfw.ext.card.Card[] getCards()
          Get all the cards.
 net.mlw.gfw.ext.card.CardSelectionBehavior getCardSelectionBehavior()
          Gets the CardSelectionBehavior currently set.
 int getMaxNumberOfCards()
          The max amount of cards this hand can hold.
 boolean isSelected(net.mlw.gfw.ext.card.Card card)
           
 boolean isValid(int index)
           
 void onEvent(net.mlw.gfw.event.Event event)
          This method processes an event.
 void removeCard(net.mlw.gfw.ext.card.Card card)
          Pop a card out of the hand.
 net.mlw.gfw.event.EventHandler removeEventHandler(net.mlw.gfw.event.EventHandler eventHandler)
          Removes the EventHandler from the List.
 void setCardSelectionBehavior(net.mlw.gfw.ext.card.CardSelectionBehavior cardSelectionBehavior)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

protected int size

cards

protected net.mlw.gfw.ext.card.Card[] cards

eventHandlers

protected net.mlw.gfw.event.EventHandlerList eventHandlers
Constructor Detail

DefaultHandModel

public DefaultHandModel(int size)
Method Detail

addCard

public void addCard(net.mlw.gfw.ext.card.Card card)
Description copied from interface: HandModel
Add a Card to the hand.

Specified by:
addCard in interface HandModel
Parameters:
card - The card to add.
See Also:
HandModel.addCard(net.mlw.gfw.ext.card.Card)

removeCard

public void removeCard(net.mlw.gfw.ext.card.Card card)
Description copied from interface: HandModel
Pop a card out of the hand.

Specified by:
removeCard in interface HandModel
Parameters:
card - The card to remove.
See Also:
HandModel.removeCard(net.mlw.gfw.ext.card.Card)

getCards

public net.mlw.gfw.ext.card.Card[] getCards()
Description copied from interface: HandModel
Get all the cards.

Specified by:
getCards in interface HandModel
Returns:
The Card(s).
See Also:
HandModel.getCards()

getCard

public net.mlw.gfw.ext.card.Card getCard(int index)
Description copied from interface: HandModel
Peek at a card in the hand.

Specified by:
getCard in interface HandModel
Parameters:
index - The location of the card.
Returns:
The Card.
See Also:
HandModel.getCard(int)

getMaxNumberOfCards

public int getMaxNumberOfCards()
Description copied from interface: HandModel
The max amount of cards this hand can hold.

Specified by:
getMaxNumberOfCards in interface HandModel
Returns:
The max amount of cards this hand can hold.
See Also:
HandModel.getMaxNumberOfCards()

isValid

public boolean isValid(int index)
See Also:
net.mlw.gfw.ext.card.HandModel#isValid(int)

onEvent

public void onEvent(net.mlw.gfw.event.Event event)
Description copied from interface: EventHandler
This method processes an event.

Specified by:
onEvent in interface EventHandler
Parameters:
event - The Event to be processed.
See Also:
EventHandler.onEvent(net.mlw.gfw.event.Event)

addEventHandler

public net.mlw.gfw.event.EventHandler addEventHandler(net.mlw.gfw.event.EventHandler eventHandler)
Description copied from interface: EventHandlerContainer
Adds a EventHandler to the internal List of EventHandlers.

Specified by:
addEventHandler in interface EventHandlerContainer
Parameters:
eventHandler - The EventHandler to add.
See Also:
EventHandlerContainer.addEventHandler(net.mlw.gfw.event.EventHandler)

removeEventHandler

public net.mlw.gfw.event.EventHandler removeEventHandler(net.mlw.gfw.event.EventHandler eventHandler)
Description copied from interface: EventHandlerContainer
Removes the EventHandler from the List.

Specified by:
removeEventHandler in interface EventHandlerContainer
Parameters:
eventHandler - The EventHandler to remove.
See Also:
EventHandlerContainer.removeEventHandler(net.mlw.gfw.event.EventHandler)

getCardSelectionBehavior

public net.mlw.gfw.ext.card.CardSelectionBehavior getCardSelectionBehavior()
Description copied from interface: HandModel
Gets the CardSelectionBehavior currently set.

Specified by:
getCardSelectionBehavior in interface HandModel
Returns:
Returns the cardSelectionBehavior.

setCardSelectionBehavior

public void setCardSelectionBehavior(net.mlw.gfw.ext.card.CardSelectionBehavior cardSelectionBehavior)
Specified by:
setCardSelectionBehavior in interface HandModel
Parameters:
cardSelectionBehavior - The cardSelectionBehavior to set.

isSelected

public boolean isSelected(net.mlw.gfw.ext.card.Card card)
Specified by:
isSelected in interface HandModel
See Also:
HandModel.isSelected(Card)

fireChange

public void fireChange()
(non-Javadoc)

Specified by:
fireChange in interface HandModel
See Also:
HandModel.fireChange()


Copyright © 2003-2004 mlavilson. All Rights Reserved.