Class PeerImpl


  • public final class PeerImpl
    extends Object
    This class provides an implementation of the Peer interface. Classes that implement Peer will typically hold an instance of this interface and delegate calls on the Peer interface to the instance of PeerImpl..

    A Peer can add another Peer to its peer list via addPeer(). All Peers in the peer list will be notified of peer changes when updateFromPeer() is called.

    • Constructor Detail

      • PeerImpl

        public PeerImpl​(Peer src)
    • Method Detail

      • addPeer

        public void addPeer​(Peer peerNode)
        Add a peer node to be notified of state changes.
        Parameters:
        peerNode - - The reference to the peer object to be added.
      • addPeeredNode

        public void addPeeredNode​(Peer peer)
        Called when a peer adds this as a peer.
        Parameters:
        peer - the peer adding this as a peer.
      • clearPeers

        public void clearPeers()
        clear all peer relationships
      • deafen

        public void deafen()
      • getPeer

        public Peer getPeer​(int nPeer)
        return the requested peer
        Parameters:
        nPeer - - the 0-based position of the peer to retrieve.
        Returns:
        the peer at the requested position. When there are not more peers to return, this will return a null object.
      • isDeaf

        public boolean isDeaf()
      • isMute

        public boolean isMute()
      • mute

        public void mute()
      • notifyPeers

        public void notifyPeers​(int eventType,
                                String arg1,
                                Object arg2)
      • removeFromList

        public void removeFromList​(Peer peer,
                                   Peer[] peerList)
      • removePeer

        public void removePeer​(Peer peerNode)
        Remove a peer node from the notification list.
        Parameters:
        peerNode - - The reference to the peer object to be removed.
      • removePeeredNode

        public void removePeeredNode​(Peer peer)
      • unDeafen

        public void unDeafen()
      • unMute

        public void unMute()