jskat.data
Class SkatGameData

java.lang.Object
  extended by java.util.Observable
      extended by jskat.data.SkatGameData

public class SkatGameData
extends java.util.Observable

A skat game

Author:
Jan Schäfer

Field Summary
(package private) static org.apache.log4j.Logger log
           
 
Constructor Summary
SkatGameData()
          Creates a new instance of a new game
 
Method Summary
 void addToScore(int player, int trickValue)
          Adds the value of a trick to the score of a player
 void addTrick(int foreHand)
          Adds a trick
 void calcRamschResult()
          Calculates the result of a Ramsch game
 void calcResult()
           
 void clearSkat()
          Clears the skat
 void geschoben()
          Raises the value of geschoben by 1
 GameAnnouncement getAnnoucement()
          Gets the game annoucement
 int getBidValue()
          Returns the bid value of the game
 boolean getClubJack()
          Returns TRUE if the player had the club jack
 int getDealer()
          Gets the first forehand for the game
 java.util.Vector<CardVector> getDealtCards()
          Gets the dealt cards
 boolean getDiamondJack()
          Returns TRUE if the player had the diamond jack
 int getGameResult()
          Returns the result of the game
 int getGameType()
          Returns the type of the game
 int getGeschoben()
          Gets the number of geschoben
 int getGeschobenMultiplier()
          Gets the geschoben multiplier
 boolean getHeartJack()
          Returns TRUE if the player had the heart jack
 int getOpponentScore()
           
 boolean getOverBidded()
          Returns TRUE if the player has overbidded
 CardVector getPlayerCards(int playerID)
           
 JSkatPlayer[] getPlayers()
          Gets the players of the game
 int getRamschAugen()
          Gets the points of a ramsch game
 int getResult()
          Gets the result of a game
 int getScore(int player)
          Gets the score of a player
 int getSinglePlayer()
          Returns the single player of the game
 int getSinglePlayerScore()
          Gets the score of the single player
 CardVector getSkat()
          Gets a reference to the skat for the game
 int getSkatOwner()
          Returns the skat owner
 boolean getSpadeJack()
          Returns TRUE if the player had the spade jack
 java.util.Vector<Trick> getTricks()
          Gets all tricks
 int getTrickWinner(int trickNumber)
          Gets the winner of the trick
 int getTrump()
          Returns the type of the game
 boolean isBock()
          Gets whether bock was announced or not
 boolean isContra()
          Gets whether contra was announced or not
 boolean isDurchMarsch()
          Gets whether a durchmarsch was done in a ramsch game or not
 boolean isGameLost()
          Gets whether the game was lost or not
 boolean isHand()
          Gets whether the single player has played a hand game or not
 boolean isJungFrau()
          Gets whether someone was jungfrau in a ramsch game or not
 boolean isOuvert()
          Gets whether the single player has played an ouvert game or not
 boolean isRe()
          Gets whether re was announced or not
 boolean isSchneider()
          Gets whether one party played schneider or not
 boolean isSchneiderAnnounced()
          Gets whether schneider was announced or not
 boolean isSchwarz()
          Gets whether schwarz was played or not
 boolean isSchwarzAnnounced()
          Gets whether schwarz was announced or not
 void setAnnouncement(GameAnnouncement announcement)
          Sets the game annoucement
 void setBidValue(int value)
          Set the bid value of the game
 void setBock(boolean bock)
          Sets whether bock was announced or not
 void setClubJack(boolean clubJack)
          Set TRUE if the player had the club jack
 void setContra(boolean contra)
          Sets whether contra was announced or not
 void setDealer(int firstForeHand)
          Sets the first forehand for the game
 void setDealtCard(int playerID, Card card)
          Sets a dealt card
 void setDiamondJack(boolean diamondJack)
          Set TRUE if the player had the diamond jack
 void setDurchMarsch(boolean durchMarsch)
          Sets a durchmarsch was done in a ramsch game or not
 void setGameLost(boolean gameLost)
          Sets whether the game was lost or not
 void setGameResult(int result)
          Sets the result of the game manually (for overbidded games)
 void setGameType(int gameType)
          Set the type of the game
 void setHand(boolean hand)
          Set TRUE if the single player has played a hand game
 void setHeartJack(boolean heartJack)
          Set TRUE if the player had the heart jack
 void setJungFrau(boolean jungFrau)
          Sets whether someone was jungfrau in a ramsch game or not
 void setOuvert(boolean ouvert)
          Sets whether the single player has played an ouvert game or not
 void setOverBidded(boolean overBidded)
          Set TRUE if the player has overbidded
 void setPlayers(JSkatPlayer[] players)
          Sets the players of the game
 void setRamschAugen(int ramschAugen)
          Sets the points of a ramsch game
 void setRe(boolean re)
          Sets whether re was announced or not
 void setSchneider(boolean schneider)
          Sets whether one party played schneider or not
 void setSchneiderAnnounced(boolean schneiderAnnounced)
          Sets whether schneider was announced or not
 void setSchwarz(boolean schwarz)
          Sets whether schwarz was played or not
 void setSchwarzAnnounced(boolean schwarzAnnounced)
          Sets whether schwarz was announced or not
 void setSinglePlayer(int singlePlayer)
          Set the single player of the game
 void setSkatOwner(int skatOwner)
          Sets the owner of the skat
 void setSpadeJack(boolean spadeJack)
          Set TRUE if the player had the spade jack
 void setTrickCard(int trickNumber, int cardNumber, Card card)
          Sets a trick card
 void setTrickWinner(int trickNumber, int winner)
          Sets the trick winner
 void setTrump(int trump)
          Set the type of the game
 void updatePlayerCards(int playerID, CardVector oldSkat)
           
 
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

log

static org.apache.log4j.Logger log
Constructor Detail

SkatGameData

public SkatGameData()
Creates a new instance of a new game

Method Detail

getGameResult

public int getGameResult()
Returns the result of the game


setGameResult

public void setGameResult(int result)
Sets the result of the game manually (for overbidded games)


getSinglePlayer

public int getSinglePlayer()
Returns the single player of the game


setSinglePlayer

public void setSinglePlayer(int singlePlayer)
Set the single player of the game


getBidValue

public int getBidValue()
Returns the bid value of the game


setBidValue

public void setBidValue(int value)
Set the bid value of the game


getGameType

public int getGameType()
Returns the type of the game


setGameType

public void setGameType(int gameType)
Set the type of the game


getTrump

public int getTrump()
Returns the type of the game


setTrump

public void setTrump(int trump)
Set the type of the game


isGameLost

public boolean isGameLost()
Gets whether the game was lost or not

Returns:
TRUE if the game was lost

setGameLost

public void setGameLost(boolean gameLost)
Sets whether the game was lost or not

Parameters:
gameLost - TRUE if the game was lost

getOverBidded

public boolean getOverBidded()
Returns TRUE if the player has overbidded


setOverBidded

public void setOverBidded(boolean overBidded)
Set TRUE if the player has overbidded


getClubJack

public boolean getClubJack()
Returns TRUE if the player had the club jack


setClubJack

public void setClubJack(boolean clubJack)
Set TRUE if the player had the club jack


getSpadeJack

public boolean getSpadeJack()
Returns TRUE if the player had the spade jack


setSpadeJack

public void setSpadeJack(boolean spadeJack)
Set TRUE if the player had the spade jack


getHeartJack

public boolean getHeartJack()
Returns TRUE if the player had the heart jack


setHeartJack

public void setHeartJack(boolean heartJack)
Set TRUE if the player had the heart jack


getDiamondJack

public boolean getDiamondJack()
Returns TRUE if the player had the diamond jack


setDiamondJack

public void setDiamondJack(boolean diamondJack)
Set TRUE if the player had the diamond jack


isHand

public boolean isHand()
Gets whether the single player has played a hand game or not

Returns:
TRUE if the single player has played a hand game

setHand

public void setHand(boolean hand)
Set TRUE if the single player has played a hand game

Parameters:
hand - TRUE if the single player has played a hand game

isOuvert

public boolean isOuvert()
Gets whether the single player has played an ouvert game or not

Returns:
TRUE if the single player has played an ouvert game

setOuvert

public void setOuvert(boolean ouvert)
Sets whether the single player has played an ouvert game or not

Parameters:
ouvert - TRUE if the single player has played an ouvert game

isSchneider

public boolean isSchneider()
Gets whether one party played schneider or not

Returns:
TRUE if the single player or the opponents played schneider

setSchneider

public void setSchneider(boolean schneider)
Sets whether one party played schneider or not

Parameters:
schneider - TRUE if the single player or the opponents played schneider

isSchneiderAnnounced

public boolean isSchneiderAnnounced()
Gets whether schneider was announced or not

Returns:
TRUE if Schneider was announced

setSchneiderAnnounced

public void setSchneiderAnnounced(boolean schneiderAnnounced)
Sets whether schneider was announced or not

Parameters:
schneiderAnnounced - TRUE if Schneider was announced

isSchwarz

public boolean isSchwarz()
Gets whether schwarz was played or not

Returns:
TRUE if the player or the opponents played schwarz

setSchwarz

public void setSchwarz(boolean schwarz)
Sets whether schwarz was played or not

Parameters:
schwarz - TRUE if the player or the opponents played schwarz

isSchwarzAnnounced

public boolean isSchwarzAnnounced()
Gets whether schwarz was announced or not

Returns:
TRUE if schwarz was announced

setSchwarzAnnounced

public void setSchwarzAnnounced(boolean schwarzAnnounced)
Sets whether schwarz was announced or not

Parameters:
schwarzAnnounced - TRUE if schwarz was announced

isContra

public boolean isContra()
Gets whether contra was announced or not

Returns:
TRUE if contra was announced

setContra

public void setContra(boolean contra)
Sets whether contra was announced or not

Parameters:
contra - TRUE if contra was announced

isRe

public boolean isRe()
Gets whether re was announced or not

Returns:
TRUE if re was announced

setRe

public void setRe(boolean re)
Sets whether re was announced or not

Parameters:
re - TRUE if re was announced

isBock

public boolean isBock()
Gets whether bock was announced or not

Returns:
TRUE if bock was announced

setBock

public void setBock(boolean bock)
Sets whether bock was announced or not

Parameters:
bock - TRUE if bock was announced

getRamschAugen

public int getRamschAugen()
Gets the points of a ramsch game

Returns:
The points of a ramsch game

setRamschAugen

public void setRamschAugen(int ramschAugen)
Sets the points of a ramsch game

Parameters:
ramschAugen - The points of a ramsch game to be set

isDurchMarsch

public boolean isDurchMarsch()
Gets whether a durchmarsch was done in a ramsch game or not

Returns:
TRUE if someone did a durchmarsch in a ramsch game

setDurchMarsch

public void setDurchMarsch(boolean durchMarsch)
Sets a durchmarsch was done in a ramsch game or not

Parameters:
durchMarsch - TRUE if someone did a durchmarsch in a ramsch game

isJungFrau

public boolean isJungFrau()
Gets whether someone was jungfrau in a ramsch game or not

Returns:
TRUE if someone was jungfrau in a ramsch game

setJungFrau

public void setJungFrau(boolean jungFrau)
Sets whether someone was jungfrau in a ramsch game or not

Parameters:
jungFrau - TRUE if someone was jungfrau in a ramsch game

addToScore

public void addToScore(int player,
                       int trickValue)
Adds the value of a trick to the score of a player

Parameters:
player - The ID of the player
trickValue - The value of the trick

getScore

public int getScore(int player)
Gets the score of a player

Parameters:
player - The ID of a player
Returns:
The score of a player

getSinglePlayerScore

public int getSinglePlayerScore()
Gets the score of the single player

Returns:
The score of the single player

getOpponentScore

public int getOpponentScore()
Returns:
Score The score of the opponent player

calcResult

public void calcResult()

calcRamschResult

public void calcRamschResult()
Calculates the result of a Ramsch game


getResult

public int getResult()
Gets the result of a game

Returns:
The result of a game

addTrick

public void addTrick(int foreHand)
Adds a trick

Parameters:
foreHand - The player ID of the forehand in the trick

setTrickCard

public void setTrickCard(int trickNumber,
                         int cardNumber,
                         Card card)
Sets a trick card

Parameters:
trickNumber - The number of the trick in a game
cardNumber - The number of the card in the trick
card - The ID of the card that was played

setTrickWinner

public void setTrickWinner(int trickNumber,
                           int winner)
Sets the trick winner

Parameters:
trickNumber - The number of the trick in a game
winner - The player ID of the winner of the trick

getTrickWinner

public int getTrickWinner(int trickNumber)
Gets the winner of the trick

Parameters:
trickNumber - The number of the trick in a game
Returns:
The player ID of the trick winner

getTricks

public java.util.Vector<Trick> getTricks()
Gets all tricks

Returns:
Vector of tricks

getGeschoben

public int getGeschoben()
Gets the number of geschoben

Returns:
Returns the number of geschoben

getGeschobenMultiplier

public int getGeschobenMultiplier()
Gets the geschoben multiplier

Returns:
Returns the geschoben multiplier

geschoben

public void geschoben()
Raises the value of geschoben by 1


getSkatOwner

public int getSkatOwner()
Returns the skat owner

Returns:
The player ID of the skat owner

setSkatOwner

public void setSkatOwner(int skatOwner)
Sets the owner of the skat

Parameters:
skatOwner - The player ID of the skat owner to be set

setPlayers

public void setPlayers(JSkatPlayer[] players)
Sets the players of the game

Parameters:
players - An array of the players

getPlayers

public JSkatPlayer[] getPlayers()
Gets the players of the game

Returns:
An array of the players

getPlayerCards

public CardVector getPlayerCards(int playerID)

updatePlayerCards

public void updatePlayerCards(int playerID,
                              CardVector oldSkat)

setDealer

public void setDealer(int firstForeHand)
Sets the first forehand for the game

Parameters:
firstForeHand - The player ID of the first forehand

getDealer

public int getDealer()
Gets the first forehand for the game

Returns:
The player ID of the first forehand

getSkat

public CardVector getSkat()
Gets a reference to the skat for the game

Returns:
skat The cards of the skat

clearSkat

public void clearSkat()
Clears the skat


getDealtCards

public java.util.Vector<CardVector> getDealtCards()
Gets the dealt cards

Returns:
The dealt cards

setDealtCard

public void setDealtCard(int playerID,
                         Card card)
Sets a dealt card


setAnnouncement

public void setAnnouncement(GameAnnouncement announcement)
Sets the game annoucement

Parameters:
announcement - The game annoucement

getAnnoucement

public GameAnnouncement getAnnoucement()
Gets the game annoucement

Returns:
The game annoucement