Package org.drasyl.peer.connection
Class PeerChannelGroup
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<io.netty.channel.Channel>
io.netty.channel.group.DefaultChannelGroup
org.drasyl.peer.connection.PeerChannelGroup
- All Implemented Interfaces:
 io.netty.channel.group.ChannelGroup,Comparable<io.netty.channel.group.ChannelGroup>,Iterable<io.netty.channel.Channel>,Collection<io.netty.channel.Channel>,Set<io.netty.channel.Channel>
public class PeerChannelGroup
extends io.netty.channel.group.DefaultChannelGroup
Special type of 
ChannelGroup, which has a lookup complexity of O(1) instead of O(n) for
 lookups by CompressedPublicKey.- 
Constructor Summary
ConstructorsConstructorDescriptionPeerChannelGroup(int networkId, Identity identity) PeerChannelGroup(int networkId, Identity identity, io.netty.util.concurrent.EventExecutor executor)  - 
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(io.netty.channel.Channel channel) booleanadd(CompressedPublicKey publicKey, io.netty.channel.Channel channel) booleanio.netty.channel.Channelfind(CompressedPublicKey publicKey) Searches the channel for given public key.inthashCode()booleanio.netty.util.concurrent.Future<Void>writeAndFlush(CompressedPublicKey publicKey, Object message) Methods inherited from class io.netty.channel.group.DefaultChannelGroup
clear, close, close, compareTo, contains, deregister, deregister, disconnect, disconnect, find, flush, flush, flushAndWrite, flushAndWrite, isEmpty, iterator, name, newCloseFuture, newCloseFuture, size, toArray, toArray, toString, write, write, write, writeAndFlush, writeAndFlush, writeAndFlushMethods inherited from class java.util.AbstractSet
removeAllMethods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAllMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
addAll, containsAll, removeAll, retainAll, spliterator 
- 
Constructor Details
- 
PeerChannelGroup
 - 
PeerChannelGroup
public PeerChannelGroup(int networkId, Identity identity, io.netty.util.concurrent.EventExecutor executor)  
 - 
 - 
Method Details
- 
writeAndFlush
public io.netty.util.concurrent.Future<Void> writeAndFlush(CompressedPublicKey publicKey, Object message) - Parameters:
 publicKey- the recipient of a message as compressed public keymessage- the message to send- Returns:
 - a completed future if the message was successfully processed, otherwise an exceptionally future
 
 - 
find
Searches the channel for given public key.- Parameters:
 publicKey- public key for which a channel should be searched- Returns:
 - the 
channelif found, otherwisenull 
 - 
add
public boolean add(io.netty.channel.Channel channel) - Specified by:
 addin interfaceCollection<io.netty.channel.Channel>- Specified by:
 addin interfaceSet<io.netty.channel.Channel>- Overrides:
 addin classio.netty.channel.group.DefaultChannelGroup
 - 
remove
- Specified by:
 removein interfaceCollection<io.netty.channel.Channel>- Specified by:
 removein interfaceSet<io.netty.channel.Channel>- Overrides:
 removein classio.netty.channel.group.DefaultChannelGroup
 - 
hashCode
public int hashCode()- Specified by:
 hashCodein interfaceCollection<io.netty.channel.Channel>- Specified by:
 hashCodein interfaceSet<io.netty.channel.Channel>- Overrides:
 hashCodein classio.netty.channel.group.DefaultChannelGroup
 - 
equals
- Specified by:
 equalsin interfaceCollection<io.netty.channel.Channel>- Specified by:
 equalsin interfaceSet<io.netty.channel.Channel>- Overrides:
 equalsin classio.netty.channel.group.DefaultChannelGroup
 - 
add
 
 -