jagafa
Class JassRoundCore

java.lang.Object
  extended by java.util.Observable
      extended by jagafa.JassRoundCore
Direct Known Subclasses:
JassRound

public abstract class JassRoundCore
extends java.util.Observable

Author:
Besitzer

Field Summary
protected  javax.swing.Timer aiTimer_
           
protected  javax.swing.Timer refreshTimer_
           
protected  boolean running_
           
protected  ScoreTable scoreTable_
           
 
Constructor Summary
JassRoundCore(RuleSet rules)
          Initialize a new game using the RuleSet given
 
Method Summary
 Board activeBoard()
          Returns the active Board
 Player activePlayer()
          Returns the active Player
 int activePlayerNr()
          Returns the active Players' id
protected  void addPlayer(Player newPlayer)
           
 GoneCardHeap getGoneHeap()
          Returns the Gone Card Heap
protected  Player getLastTurnWinner()
          Returns the Player which was the winner of the previous turn
 Player[] getOpponents(Player p)
          Returns the opponents of the Player p
 Player getPartner(Player pl)
          Returns the Partner of Player pl
 Player getPlayer(int i)
          Returns the player with the id given
 int getPlayerNr(Player p)
          Returns an id for the player p
 RuleSet getRules()
          Returns the RuleSet
protected  int getScore(Board board)
          Counts the score on a board
 ScoreTable getScoreTable()
          Get the score table
protected  Player getWinner(Board board)
          Returns the winning Player of the board given
protected abstract  void initPlayers()
           
 boolean isRoundOver()
          Returns true if the game is over
 boolean isRunning()
           
 boolean isValidPlay(Card toPlay)
          Checks wether a card is valid to play on the active Board or not
protected  Player nextPlayer()
          Sets the active player to the next
protected  void reportScores()
          Update the score table after a round is finished (Report round scores to top-level game)
 void reset()
          Reset everything
 void setActivePlayer(Player playerToSet)
          Set the active player
protected  void setLastTurnWinner(Player winner)
           
 void setRules(RuleSet r)
          Set the RuleSet
 void setScoreTable(ScoreTable table)
          Sets the score table
 void stop()
           
 void toggleNotify()
          Notify observers and fire all action-listeners
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

running_

protected boolean running_

refreshTimer_

protected javax.swing.Timer refreshTimer_

aiTimer_

protected javax.swing.Timer aiTimer_

scoreTable_

protected ScoreTable scoreTable_
Constructor Detail

JassRoundCore

public JassRoundCore(RuleSet rules)
Initialize a new game using the RuleSet given

Method Detail

setRules

public void setRules(RuleSet r)
Set the RuleSet


isRunning

public boolean isRunning()

activePlayerNr

public int activePlayerNr()
Returns the active Players' id


activePlayer

public Player activePlayer()
Returns the active Player


getScore

protected int getScore(Board board)
Counts the score on a board


getWinner

protected Player getWinner(Board board)
Returns the winning Player of the board given


isRoundOver

public boolean isRoundOver()
Returns true if the game is over


nextPlayer

protected Player nextPlayer()
Sets the active player to the next


setActivePlayer

public void setActivePlayer(Player playerToSet)
Set the active player


toggleNotify

public void toggleNotify()
Notify observers and fire all action-listeners


getPlayer

public Player getPlayer(int i)
Returns the player with the id given


getLastTurnWinner

protected Player getLastTurnWinner()
Returns the Player which was the winner of the previous turn


getPlayerNr

public int getPlayerNr(Player p)
Returns an id for the player p


getRules

public RuleSet getRules()
Returns the RuleSet


getGoneHeap

public GoneCardHeap getGoneHeap()
Returns the Gone Card Heap


getPartner

public Player getPartner(Player pl)
Returns the Partner of Player pl


getOpponents

public Player[] getOpponents(Player p)
Returns the opponents of the Player p


isValidPlay

public boolean isValidPlay(Card toPlay)
Checks wether a card is valid to play on the active Board or not


activeBoard

public Board activeBoard()
Returns the active Board


reset

public void reset()
Reset everything


initPlayers

protected abstract void initPlayers()

setLastTurnWinner

protected void setLastTurnWinner(Player winner)

addPlayer

protected void addPlayer(Player newPlayer)

setScoreTable

public void setScoreTable(ScoreTable table)
Sets the score table

Parameters:
table - The relevant score table where the rounds score will be reported

getScoreTable

public ScoreTable getScoreTable()
Get the score table

Returns:
The score table relevant for this round

reportScores

protected void reportScores()
Update the score table after a round is finished (Report round scores to top-level game)


stop

public void stop()


Copyright 2005 MA Software. All Rights Reserved.