Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## gecco.communication.server
Class RoleConnection

    java.lang.Object
      gecco.communication.server.RoleConnection

public class RoleConnection
extends Object

A class that represents the connection from the server to a specific role. So this class keeps track of all the clients that have joined as that specific role

Author:
  Niklas Hallenfur

Constructor Summary
`RoleConnection(String role, Server server)` Constructor for the RoleConnection object

Method Summary
`void` | `add(ClientConnection c)` adds a new client to this role
`int` | `getAvailableId()` returns the lowest nonnegative integer that is not used as an id by any client
`int` | `getNumberOfClients()` returns the number of clients connected to this role
`void` | `remove(ClientConnectionHandler c)` removes a client from this role
`void` | `sendMessage(Message m)` called by ClientAmbassodor to send a message to this role This method then distributes this message to all clients connected as this role
`String` | `whoIsConnected()` returns a string with the names of the clients connected to this role.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RoleConnection

    public RoleConnection(String role,
                          Server server)

  Constructor for the RoleConnection object

Parameters:
  `role` - Description of Parameter
  `server` - Description of Parameter

Method Detail

### getNumberOfClients

    public int getNumberOfClients()

  returns the number of clients connected to this role

  Returns:
    The NumberOfClients value

### getAvailableId

    public int getAvailableId()

  returns the lowest nonnegative integer that is not used as an id by any client

  Returns:
    The AvailableId value

### add

    public void add(ClientConnection c)

  adds a new client to this role

  Parameters:
    `c` - Description of Parameter

### remove

    public void remove(ClientConnectionHandler c)

  removes a client from this role

  Parameters:
    `c` - Description of Parameter

### whoIsConnected

    public String whoIsConnected()

  returns a string with the names of the clients connected to this role. The name is defined as the role immediately followed by the client's unique id

  Returns:
    Description of the Returned Value

### sendMessage

    public void sendMessage(Message m)

  called by ClientAmbassodor to send a message to this role This method then distributes this message to all clients connected as this role

  Parameters:
    `m` - Description of Parameter

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD