|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.ninm.games.cardgames.common.AbstractEngine
This class provides a skeletal implementation of the card game engine which most card games should subclass.
Field Summary | |
private javax.swing.event.EventListenerList |
m_eventListenerList
|
Constructor Summary | |
AbstractEngine()
|
Method Summary | |
void |
addBonusListener(BonusListener bonusListener)
registers the bonus listener with this engine |
void |
addDealerListener(DealerListener dealerListener)
registers the dealer listener with this engine |
boolean |
announceTrick(Player player,
Trick trick)
this implementation just checks weather the player making the anouncement is the currant player and weather the trick is one of the allowed tricks. |
boolean |
bidMade(Player player,
Bid bid)
this implementation just checks weather the player making the anouncement is the currant player and weather the trick is one of the allowed tricks. |
protected void |
fireBonusReceived(Player player,
Team team,
Bonus bonus)
helper method to let every listener know of the bonus being received |
protected void |
fireCardDelt(Player player,
Team team,
Player dealer,
Card card)
helper method to let every listener know that a card has been delt |
protected boolean |
isAllowedBid(Bid bid)
a helper method used to determine if the passed in bid is one of the allowed bid |
protected boolean |
isAllowedCard(Card card)
a helper method used to determine if the card passed in is one of the allowed cards to be played now |
protected boolean |
isAllowedTrick(Trick trick)
a helper method used to determine if the passed in trick is one of the allowed tricks |
protected boolean |
isCurrantPlayer(Player player)
a helper method used to determine if the passed in player is the currant player |
boolean |
playCard(Player player,
Card card)
This implementation just checks weather the player is the currante player and weather the card is one of the allowed cards. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.ninm.games.cardgames.Engine |
getActivePlayer, getAllowedBids, getAllowedCards, getAllowedTricks |
Field Detail |
private final javax.swing.event.EventListenerList m_eventListenerList
Constructor Detail |
public AbstractEngine()
Method Detail |
public boolean playCard(Player player, Card card)
playCard
in interface Engine
player
- the player playing the cardcard
- the card being player
public boolean announceTrick(Player player, Trick trick)
announceTrick
in interface Engine
player
- the player announcing the tricktrick
- the trick being announced
public boolean bidMade(Player player, Bid bid)
bidMade
in interface Engine
player
- the player making the bidbid
- the bid being made
protected boolean isCurrantPlayer(Player player)
player
- the player to be compared
protected boolean isAllowedTrick(Trick trick)
trick
- the trick to be compared
protected boolean isAllowedBid(Bid bid)
bid
- the bid to be compared
protected boolean isAllowedCard(Card card)
card
- the card to be compared
public void addBonusListener(BonusListener bonusListener)
Engine
addBonusListener
in interface Engine
bonusListener
- the bonus listenerpublic void addDealerListener(DealerListener dealerListener)
Engine
addDealerListener
in interface Engine
dealerListener
- the dealer listenerprotected void fireBonusReceived(Player player, Team team, Bonus bonus)
player
- the player receiving the bonusteam
- the team receiving the bonusbonus
- the bonus being receivedprotected void fireCardDelt(Player player, Team team, Player dealer, Card card)
player
- the player receiving the cardteam
- the team that the player belongs todealer
- the dealer dealing the cardcard
- the card being delt
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |