net.jetrix
Class ChannelManager

java.lang.Object
  extended by net.jetrix.ChannelManager

public class ChannelManager
extends Object

Manages Channels

Version:
$Revision: 538 $, $Date: 2004-12-18 02:14:26 +0100 (sam., 18 déc. 2004) $
Author:
Emmanuel Bourg

Method Summary
 Collection<Channel> channels()
          Returns an iterator over the channels available.
 void clear()
          Clear the channel list.
 void closeAll()
          Close all channels.
 Channel createChannel(ChannelConfig config)
          Create a channel and start it immediately.
 Channel createChannel(ChannelConfig config, boolean start)
          Create a channel initialized with the specified configuration.
 Channel getChannel(int num)
          Get a channel by number in the list.
 Channel getChannel(String name)
          Return the channel with the specified name.
 Channel getChannel(String name, boolean partial)
          Returns the channel with the specified name.
 int getChannelCount()
          Returns the number of existing channels.
 Channel getHomeChannel(int level)
          Return the most suitable home channel for a player newly connected, that's the first accessible channel with players to play with.
static ChannelManager getInstance()
           
 Channel getOpenedChannel()
          Deprecated.  
 void removeChannel(Channel channel)
          Remove a channel.
 void removeChannel(String name)
          Remove a channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ChannelManager getInstance()

createChannel

public Channel createChannel(ChannelConfig config)
Create a channel and start it immediately.

Parameters:
config - the channel configuration

createChannel

public Channel createChannel(ChannelConfig config,
                             boolean start)
Create a channel initialized with the specified configuration.

Parameters:
config - the channel configuration
start - initial state

removeChannel

public void removeChannel(String name)
Remove a channel.


removeChannel

public void removeChannel(Channel channel)
Remove a channel.


getChannelCount

public int getChannelCount()
Returns the number of existing channels.


channels

public Collection<Channel> channels()
Returns an iterator over the channels available.


getOpenedChannel

public Channel getOpenedChannel()
Deprecated. 

Looks for a channel with room left.

Returns:
null if there is no room left in all available channels

getHomeChannel

public Channel getHomeChannel(int level)
Return the most suitable home channel for a player newly connected, that's the first accessible channel with players to play with. The channel selected matches the following criteria:

Parameters:
level - the access level of the player added in the channel
Since:
0.2

getChannel

public Channel getChannel(String name)
Return the channel with the specified name. The leading # is removed from the name before searching. The name is not case sensitive.

Parameters:
name - the name of the channel to find
Returns:

getChannel

public Channel getChannel(String name,
                          boolean partial)
Returns the channel with the specified name. The leading # is removed from the name before searching. The name is not case sensitive. If no channel matches the name specified, it can return the first channel starting with the name if the partial parameter is set to true.

Parameters:
name - the name of the channel to find
partial - use the partial name matching
Returns:
instance of the specified channel, null if not found

clear

public void clear()
Clear the channel list.


closeAll

public void closeAll()
Close all channels.


getChannel

public Channel getChannel(int num)
Get a channel by number in the list.



Copyright © 2001-2008 Emmanuel Bourg. All Rights Reserved.