ch.epfl.lpd.ids.server
Class InternalClient

java.lang.Object
  extended by ch.epfl.lpd.ids.server.InternalClient

public class InternalClient
extends Object

This class is the internal representation of a chat client for the server. This class stores the username of the client and a IBlockingQueue that will be used by the client to retrieve the different messages send by the other chat clients.

Author:
Sebastien Baehni

Field Summary
protected  IBlockingQueue<IMessage> blockingQueue
          The IBlockingQueue used for retrieving the different messages sent by the other chat clients.
protected  String username
          The username of this internal client.
 
Constructor Summary
InternalClient(String username)
          Creates a new instance of InternalClient.
 
Method Summary
 IMessage getNextMessage()
          Method used to retrieve the last element, not already taken, that is in the IBlockingQueue of this internal client.
 String getUsername()
          Method used to get the username of this internal client.
 void putMessage(IMessage msg)
          Method used to put a new IMessage into the IBlockingQueue of this internal client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

username

protected String username
The username of this internal client.


blockingQueue

protected IBlockingQueue<IMessage> blockingQueue
The IBlockingQueue used for retrieving the different messages sent by the other chat clients.

Constructor Detail

InternalClient

public InternalClient(String username)
Creates a new instance of InternalClient.

Parameters:
username - The username of this internal client.
Method Detail

getUsername

public String getUsername()
Method used to get the username of this internal client.

Returns:
The username of this internal client.

putMessage

public void putMessage(IMessage msg)
Method used to put a new IMessage into the IBlockingQueue of this internal client. This method will be called by the server when it receives a new message.

Parameters:
msg - The IMessage to put in the queue.

getNextMessage

public IMessage getNextMessage()
Method used to retrieve the last element, not already taken, that is in the IBlockingQueue of this internal client.

Returns:
The last message of the IBlockingQueue of this internal client.