org.xlattice
Class Peer
java.lang.Object
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
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
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
Peer
public Peer(NodeID id)
Peer
public Peer(NodeID id,
PublicKey p,
Overlay[] o,
Connector[] c)
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