public abstract class AbstractChannel extends java.lang.Object implements Channel
| Modifier and Type | Field and Description |
|---|---|
protected int |
channelID
This channels's ID.
|
protected java.util.Collection<Entity> |
subscribers
The set of subscribers.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractChannel(int channelID)
Construct an AbstractChannel.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addMessageForAgent(Entity a,
AKSpeak msg)
Register a message that should be send to an agent on the next call to @{link #getMessagesForAgent(AgentProxy)}.
|
protected void |
addMessageForSubscribers(AKSpeak msg)
Register a message that should be send to all subscribers.
|
void |
addSubscriber(Entity a)
Add a subscriber to this channel.
|
java.util.Collection<AKSpeak> |
getMessagesForAgent(Entity agent)
Get the messages that should be send to an agent.
|
java.util.Collection<Entity> |
getSubscribers()
Get all subscribers.
|
protected boolean |
isSubscribed(Entity e)
Find out if an entity is subscribed to this channel.
|
void |
push(AKSpeak speak)
Push a message through this channel.
|
protected abstract void |
pushImpl(AKSpeak msg,
int originalSize)
Push a message after input noise has been applied.
|
void |
removeSubscriber(Entity a)
Remove a subscriber from this channel.
|
void |
setInputNoise(Noise noise)
Set the input noise object for this channel.
|
void |
setOutputNoise(Noise noise)
Set the output noise object for this channel.
|
void |
timestep()
Notify the channel that a timestep has elapsed.
|
protected java.util.Collection<Entity> subscribers
protected int channelID
protected AbstractChannel(int channelID)
channelID - The ID of this channel.public void setInputNoise(Noise noise)
ChannelsetInputNoise in interface Channelnoise - The input noise.public void setOutputNoise(Noise noise)
ChannelsetOutputNoise in interface Channelnoise - The output noise.public void timestep()
Channelpublic void addSubscriber(Entity a)
ChanneladdSubscriber in interface Channela - The subscriber.public void removeSubscriber(Entity a)
ChannelremoveSubscriber in interface Channela - The subscriber.public java.util.Collection<Entity> getSubscribers()
ChannelgetSubscribers in interface Channelpublic java.util.Collection<AKSpeak> getMessagesForAgent(Entity agent)
ChannelgetMessagesForAgent in interface Channelagent - The agent to look up.public final void push(AKSpeak speak) throws InvalidMessageException
Channelpush in interface Channelspeak - The message to push.InvalidMessageException - If the message is invalid.protected abstract void pushImpl(AKSpeak msg, int originalSize) throws InvalidMessageException
msg - The message.InvalidMessageException - If the message is invalid.protected void addMessageForAgent(Entity a, AKSpeak msg)
a - The agent.msg - The message.protected void addMessageForSubscribers(AKSpeak msg)
msg - The message.protected boolean isSubscribed(Entity e)
e - The entity to check.