swpchat.server
Class ChannelCollection
java.lang.Object
|
+--swpchat.server.ChannelCollection
- public class ChannelCollection
- extends java.lang.Object
This class saves all possible channels at the server.
- Author:
- Andre Brunner, Christian Stuellenberg, Marc Sturm
Field Summary |
private java.util.HashMap |
channelHash
|
private static java.lang.String |
CLS
|
private java.util.HashMap |
listener
|
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
CLS
private static final java.lang.String CLS
channelHash
private java.util.HashMap channelHash
listener
private java.util.HashMap listener
ChannelCollection
public ChannelCollection()
tryToAddChannel
public boolean tryToAddChannel(java.lang.String name,
Channel channel)
- Method tries to add Channel to hashtable and is threadsave
- Parameters:
nickname
- Channel
-
tryToChangeName
public boolean tryToChangeName(java.lang.String oldName,
java.lang.String newName)
throws NoSuchChannelException
- Change the nickname of a Channel.
- Parameters:
oldName,
- newName- Returns:
- false iff the newName was not allowed in the
collection.
- Throws:
NoSuchChannelException
- if there is no Channel
with the old Name in the collection.
removeChannel
public void removeChannel(java.lang.String name)
throws NoSuchChannelException
- Remove the Channel identified by its Name from the
collection.
- Parameters:
nickname
- - Throws:
NoSuchChannelException
- if there is no Channel
with the old Name in the collection.
iterator
public java.util.Iterator iterator()
getChannel
public Channel getChannel(java.lang.String channelKey)
throws NoSuchChannelException
- return the channel, that is identified by the channelKey
- Parameters:
channelKey
- String
specifying the channelName- Returns:
Channel
that is indentified by the channelKey
addListener
public void addListener(ChannelCollectionListener newListener)
- Used to add a listener to the listeners collection.
- Parameters:
newListener
- is the listener to be added.
removeListener
public void removeListener(ChannelCollectionListener oldListener)
- Used to remove a listener from the listeners collection.
- Parameters:
oldListener
- is the listener to be removed.