ch.epfl.lpd.ids
Class CentralizedChat

java.lang.Object
  extended by ch.epfl.lpd.ids.CentralizedChat
All Implemented Interfaces:
IWindowManager

public class CentralizedChat
extends Object
implements IWindowManager

CentralizedChat class used to start the local chat. This class starts the server and the different chat clients.

Author:
Sebastien Baehni

Field Summary
protected  ChatClient[] clients
          The different chat clients.
protected  int numberOfActiveClients
          The total number of active clients.
protected  int numberOfClients
          The total number of clients to start.
 
Constructor Summary
CentralizedChat(int numberOfClients)
          Creates a new instance of CentralizedChat.
 
Method Summary
 void closeClient()
          Method called by a chat client when its window is closed.
static void main(String[] args)
          The main method of the class.
static void printUsage()
          Utility method used to print a help usage menu.
 void start()
          Creates the chat server object and the different chat clients.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clients

protected ChatClient[] clients
The different chat clients.


numberOfClients

protected int numberOfClients
The total number of clients to start.


numberOfActiveClients

protected int numberOfActiveClients
The total number of active clients. This variable is used to close the application when no more active clients are available.

Constructor Detail

CentralizedChat

public CentralizedChat(int numberOfClients)
Creates a new instance of CentralizedChat.

Parameters:
numberOfClients - The total number of clients to create
Method Detail

start

public void start()
Creates the chat server object and the different chat clients.


closeClient

public void closeClient()
Method called by a chat client when its window is closed.

Specified by:
closeClient in interface IWindowManager

printUsage

public static void printUsage()
Utility method used to print a help usage menu.


main

public static void main(String[] args)
The main method of the class. This method is the entry point of the local chat application.

Parameters:
args - The arguments given when launching the application. The first and only argument specifies the number of clients to start.