GameField
Class GameField

java.lang.Object
  extended by GameField.GameField
Direct Known Subclasses:
ServerGameField

public class GameField
extends java.lang.Object

Class GameField Represents the gamefield


Field Summary
static boolean DEBUG
           
protected  Card[][] fieldCards
           
private  GUI gui
           
protected  boolean inGame
           
protected  Network network
           
protected  Cards packet
           
private  int playerPosInPlayers
           
private  java.lang.String playerPseudo
           
protected  java.util.Vector<Player> players
           
 
Constructor Summary
protected GameField(Card[][] fieldCards, Cards packet, java.util.Vector<Player> players, Network network)
           
  GameField(Network network)
           
 
Method Summary
 int[] addCardToField(Card c)
          Adds the card c in an empty position
 void addCardToField(Card c, int i, int j)
          Adds the card c at the position (i,j) on the gamefield
 void connect(java.lang.String host, int port)
          connecte le gameField au serveur ayant l'adresse host et le port port
 java.lang.String fieldCardToString()
           
 Card[][] getFieldCards()
          The logical gamefield
 GUI getGui()
           
 boolean getInGame()
           
 Network getNetwork()
          Get the value of network
 Cards getPacket()
          The 81 cards of the game
 int getPlayerPosInPlayers()
           
 java.lang.String getPlayerPseudo()
           
 java.util.Vector<Player> getPlayers()
          Get the value of players
 java.lang.String playersToString()
           
 void receiveData(int idConnection, java.lang.String data)
          traite la chaine data reçue par la connection idConnection
 void removeCardFromField(int i, int j)
          Remove the card at position (i,j) from the gamefield
 void setFieldCards(Card[][] value)
          The logical gamefield
 void setGUI(GUI gui)
          Set the value of gui
 void setNetwork(Network value)
          Set the value of network
 void setPacket(Cards value)
          The 81 cards of the game
 void setPlayerPosInPlayers(int i)
          set the value of playerPosInPlayers
 void setPlayerPseudo(java.lang.String s)
          Set the value of playerPseudo
 void setPlayers(java.util.Vector<Player> value)
          Set the value of players
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values

fieldCards

protected Card[][] fieldCards

gui

private GUI gui

inGame

protected boolean inGame

network

protected Network network

packet

protected Cards packet

playerPosInPlayers

private int playerPosInPlayers

playerPseudo

private java.lang.String playerPseudo

players

protected java.util.Vector<Player> players
Constructor Detail

GameField

protected GameField(Card[][] fieldCards,
                    Cards packet,
                    java.util.Vector<Player> players,
                    Network network)

GameField

public GameField(Network network)
Method Detail

addCardToField

public int[] addCardToField(Card c)
                     throws GameFieldException
Adds the card c in an empty position

Parameters:
c -
Returns:
int[] pos => pos[0]=position x, pos[1]=position y
Throws:
GameFieldException

addCardToField

public void addCardToField(Card c,
                           int i,
                           int j)
                    throws GameFieldException
Adds the card c at the position (i,j) on the gamefield

Parameters:
c -
i -
j -
Throws:
GameFieldException

connect

public void connect(java.lang.String host,
                    int port)
             throws GameFieldException
connecte le gameField au serveur ayant l'adresse host et le port port

Parameters:
host -
port -
Throws:
GameFieldException

fieldCardToString

public java.lang.String fieldCardToString()
Returns:
s la représentation du plateau

getFieldCards

public Card[][] getFieldCards()
The logical gamefield


getGui

public GUI getGui()
Returns:
gui

getInGame

public boolean getInGame()

getNetwork

public Network getNetwork()
Get the value of network

Returns:
the value of network

getPacket

public Cards getPacket()
The 81 cards of the game


getPlayerPosInPlayers

public int getPlayerPosInPlayers()
Returns:
playerPosInPlayers

getPlayerPseudo

public java.lang.String getPlayerPseudo()
Returns:
playerPseudo

getPlayers

public java.util.Vector<Player> getPlayers()
Get the value of players

Returns:
the value of players

playersToString

public java.lang.String playersToString()
Returns:
s la représentation des joueurs

receiveData

public void receiveData(int idConnection,
                        java.lang.String data)
traite la chaine data reçue par la connection idConnection

Parameters:
idConnection -
data -

removeCardFromField

public void removeCardFromField(int i,
                                int j)
Remove the card at position (i,j) from the gamefield

Parameters:
i -
j -

setFieldCards

public void setFieldCards(Card[][] value)
The logical gamefield


setGUI

public void setGUI(GUI gui)
Set the value of gui


setNetwork

public void setNetwork(Network value)
Set the value of network


setPacket

public void setPacket(Cards value)
The 81 cards of the game


setPlayerPosInPlayers

public void setPlayerPosInPlayers(int i)
set the value of playerPosInPlayers


setPlayerPseudo

public void setPlayerPseudo(java.lang.String s)
Set the value of playerPseudo


setPlayers

public void setPlayers(java.util.Vector<Player> value)
Set the value of players