org.xlattice
Class Peer

java.lang.Object
  extended by org.xlattice.Peer

public abstract class Peer
extends java.lang.Object

A Peer is another Node, a neighbor. XXX As this has evolved, it begins to look like Node should XXX simply extend Peer.

Author:
Jim Dixon

Field Summary
protected  java.util.ArrayList connectors
           
protected  NodeID nodeID
           
protected  java.util.ArrayList overlays
           
protected  PublicKey pubkey
          Peer's PublicKey, possibly learned via nodeID
 
Constructor Summary
Peer(NodeID id)
           
Peer(NodeID id, PublicKey p, Overlay[] o, Connector[] c)
           
 
Method Summary
 void addConnector(Connector c)
           
 void addOverlay(Overlay o)
           
 int connectorCount()
          Deprecated.  
 boolean equals(java.lang.Object o)
           
 Connector getConnector(int n)
          Return a Connector, an Address-Protocol pair identifying an Acceptor for the Peer.
 NodeID getNodeID()
           
 Overlay getOverlay(int n)
           
 PublicKey getPublicKey()
           
 int hashCode()
           
 void setPublicKey(PublicKey p)
           
 int sizeConnectors()
           
 int sizeOverlays()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodeID

protected final NodeID nodeID

pubkey

protected PublicKey pubkey
Peer's PublicKey, possibly learned via nodeID


overlays

protected final java.util.ArrayList overlays

connectors

protected final java.util.ArrayList connectors
Constructor Detail

Peer

public Peer(NodeID id)

Peer

public Peer(NodeID id,
            PublicKey p,
            Overlay[] o,
            Connector[] c)
Method Detail

getNodeID

public NodeID getNodeID()
Returns:
the 160-bit value identifying the Peer

getPublicKey

public PublicKey getPublicKey()
Returns:
the Peer's public key

setPublicKey

public void setPublicKey(PublicKey p)

addOverlay

public void addOverlay(Overlay o)

sizeOverlays

public int sizeOverlays()
Returns:
a count of the number of overlays the peer can be accessed through

getOverlay

public Overlay getOverlay(int n)
Returns:
how to access the peer (transport, protocol, address)

addConnector

public void addConnector(Connector c)

connectorCount

public int connectorCount()
Deprecated. 

Returns:
a count of known Connectors for this Peer

sizeConnectors

public int sizeConnectors()
Returns:
a count of known Connectors for this Peer

getConnector

public Connector getConnector(int n)
Return a Connector, an Address-Protocol pair identifying an Acceptor for the Peer. Connectors are arranged in order of preference, with the zero-th Connector being the most preferred. XXX Could as easily return an EndPoint.

Returns:
the Nth Connector

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object