final class ChannelManager
extends java.lang.Object
NetChannelInput
,
NetChannelOutput
Modifier and Type | Field and Description |
---|---|
private java.util.Hashtable |
channels
The table containing the channels.
|
private static int |
index
The index for the next channel to be created.
|
private static ChannelManager |
instance
Singleton instance of the ChannelManager
|
Modifier | Constructor and Description |
---|---|
private |
ChannelManager()
Private default constructor.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
create(ChannelData cd)
Allocates a new number to the channel, and stores it in the table.
|
(package private) void |
create(int idx,
ChannelData cd)
Stores a channel in the given index in the table.
|
(package private) ChannelData |
getChannel(int idx)
Retrieves a channel from the table
|
(package private) static ChannelManager |
getInstance()
Allows getting of the singleton instance.
|
(package private) void |
removeChannel(ChannelData data)
Removes a channel from the table.
|
private static int index
private final java.util.Hashtable channels
private static ChannelManager instance
private ChannelManager()
static ChannelManager getInstance()
void create(ChannelData cd)
cd
- The ChannelData for the channelvoid create(int idx, ChannelData cd) throws java.lang.IllegalArgumentException
idx
- The index to use for the channelcd
- The ChannelData for the channeljava.lang.IllegalArgumentException
- If a channel of the given index already exists.ChannelData getChannel(int idx)
idx
- Index in the table to retrieve the channel from.void removeChannel(ChannelData data)
data
- ChannelData for channel to remove