|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmail.node.Node
public abstract class Node
This class represents a user in the p2p-net. The user can be local, somewhere else in the net, or not available at all. If the user is not local some methods may take very long to terminate, because the will block until the connection was established and the needed information recieved. So it might be wise to start those methods in an extra thread.
Nested Class Summary | |
---|---|
protected class |
Node.IDComparator
|
protected class |
Node.InvertedIDComparator
|
Field Summary | |
---|---|
protected CryptEngine |
crypt
|
Constructor Summary | |
---|---|
Node()
|
Method Summary | |
---|---|
abstract void |
addNeighbor(Node n)
add's another neighbor to the node's list of neighbors |
int |
distance(ID nodeid)
calculates the distance between this and another node. |
int |
distance(Node n)
calculates the distance between this and another node. |
boolean |
equals(java.lang.Object o)
|
abstract java.util.ArrayList<Node> |
getClosest(ID nodeid)
returns the neighbors of this node sorted by distance. |
CryptEngine |
getCryptEngine()
|
ID |
getID()
fetches the ID of this node |
java.lang.String |
getKey()
|
abstract java.util.Collection<Mail> |
getMail(ID receiver)
|
abstract ID |
getName(NameID nameid)
fetches the ID that registered the name with the given ID |
abstract java.util.Collection<Node> |
getNeighbors()
returns all the neighbors of this Node |
abstract Node |
getNode(ID id)
|
int |
hashCode()
|
protected void |
markReachable(Node n)
|
java.util.Collection<Node> |
searchClosest(int num,
ID target)
|
ID |
searchName(NameID nameid)
|
Node |
searchNode(ID id)
|
abstract void |
store(Mail m)
|
abstract void |
storeName(NameID nameid,
ID user)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected CryptEngine crypt
Constructor Detail |
---|
public Node()
Method Detail |
---|
public int distance(Node n)
n
- the node to calculate the distance to
ID.distance(ID)
public int distance(ID nodeid)
n
- the node to calculate the distance to
ID.distance(ID)
public ID getID()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public abstract java.util.ArrayList<Node> getClosest(ID nodeid) throws RequestFailedException
nodeid
- the id of the node to which distance should be measured to
RequestFailedException
public abstract java.util.Collection<Node> getNeighbors() throws RequestFailedException
RequestFailedException
public abstract java.util.Collection<Mail> getMail(ID receiver) throws RequestFailedException
RequestFailedException
public abstract void store(Mail m) throws RequestFailedException
RequestFailedException
public abstract Node getNode(ID id) throws RequestFailedException
RequestFailedException
public abstract ID getName(NameID nameid) throws RequestFailedException
nameid
-
RequestFailedException
public abstract void storeName(NameID nameid, ID user) throws RequestFailedException
RequestFailedException
public abstract void addNeighbor(Node n) throws RequestFailedException
n
-
RequestFailedException
public java.lang.String getKey()
public CryptEngine getCryptEngine()
public java.util.Collection<Node> searchClosest(int num, ID target) throws RequestFailedException
RequestFailedException
public Node searchNode(ID id)
public ID searchName(NameID nameid)
public java.lang.String toString()
toString
in class java.lang.Object
protected void markReachable(Node n)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |