GameField
Class ServerGameField

java.lang.Object
  extended by GameField.GameField
      extended by GameField.ServerGameField
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class ServerGameField
extends GameField
implements java.awt.event.ActionListener


Field Summary
private  int[] color
           
private  boolean[] joined
           
private  java.io.PrintStream out
           
private  int[] pattern
           
private  boolean[] ready
           
private  javax.swing.Timer timer
           
private  int[] type
           
private  WaitConnection waitConnection
           
 
Fields inherited from class GameField.GameField
DEBUG, fieldCards, inGame, network, packet, players
 
Constructor Summary
private ServerGameField(java.io.PrintStream out, Card[][] fieldCards, java.util.Vector<Player> players, Network network, int[] type, int[] color, int[] pattern, int port, int nbClient, int helptime)
           
  ServerGameField(java.io.PrintStream out, Network network, int[] type, int[] color, int[] pattern, int port, int nbClient, int helptime)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
private  boolean differents(int a, int b, int c)
          Teste si 3 entiers sont differents 2 a 2
private  boolean equals(int a, int b, int c)
          Teste si 3 entiers sont egaux 2 a 2
private  boolean isAValidTriplet(Card c1, Card c2, Card c3)
          Returns true if {c1,c2,c3} is a valid triplet
 void receiveData(int idConnection, java.lang.String data)
          traite la chaine data reçue par la connection idConnection
 void stop()
           
private  boolean validTripletExist()
           
 
Methods inherited from class GameField.GameField
addCardToField, addCardToField, connect, fieldCardToString, getFieldCards, getGui, getInGame, getNetwork, getPacket, getPlayerPosInPlayers, getPlayerPseudo, getPlayers, playersToString, removeCardFromField, setFieldCards, setGUI, setNetwork, setPacket, setPlayerPosInPlayers, setPlayerPseudo, setPlayers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

color

private int[] color

joined

private boolean[] joined

out

private java.io.PrintStream out

pattern

private int[] pattern

ready

private boolean[] ready

timer

private javax.swing.Timer timer

type

private int[] type

waitConnection

private WaitConnection waitConnection
Constructor Detail

ServerGameField

private ServerGameField(java.io.PrintStream out,
                        Card[][] fieldCards,
                        java.util.Vector<Player> players,
                        Network network,
                        int[] type,
                        int[] color,
                        int[] pattern,
                        int port,
                        int nbClient,
                        int helptime)
                 throws GameFieldException
Throws:
GameFieldException

ServerGameField

public ServerGameField(java.io.PrintStream out,
                       Network network,
                       int[] type,
                       int[] color,
                       int[] pattern,
                       int port,
                       int nbClient,
                       int helptime)
                throws GameFieldException
Throws:
GameFieldException
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

differents

private boolean differents(int a,
                           int b,
                           int c)
Teste si 3 entiers sont differents 2 a 2

Parameters:
a -
b -
c -
Returns:
boolean : true si egalite false sinon

equals

private boolean equals(int a,
                       int b,
                       int c)
Teste si 3 entiers sont egaux 2 a 2

Parameters:
a -
b -
c -
Returns:
boolean : true si egalite false sinon

isAValidTriplet

private boolean isAValidTriplet(Card c1,
                                Card c2,
                                Card c3)
Returns true if {c1,c2,c3} is a valid triplet

Parameters:
c1 -
c2 -
c3 -

receiveData

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

Overrides:
receiveData in class GameField
Parameters:
idConnection -
data -

stop

public void stop()

validTripletExist

private boolean validTripletExist()
Returns:
true if a valid triplet exist on field