|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jcsp.net2.NodeID
public final class NodeID
This class is used to uniquely identify a Node within the entire JCSP network of Nodes in operation. This is to allow ease to identify individual Nodes when IDs come in, and to quickly find them within tables of other Links to allow usage of existing connections. This is different to a NodeAddress, which is a symbolic name representing a Node, and which therefore may be repeated. The hope here is that by using enough pieces of data the Node should have a unique identification. This is done by gathering the information on the current system time in milliseconds, the current free memory of the JVM, the hash code of a newly created object, the name of the Node, if there is one, and the address of the Node itself. Having this much information should provide us with a unique ID. Other implementations of the protocol can use other means of identifying a Node uniquely, but they must use the same amount of data, e.g. string(number 64 bits) - string(number 64 bits) - string (number 32 bits) - string - address string, when communicating with another JCSP Node for the sake of compatibility.
Constructor Summary | |
---|---|
NodeID(long long1,
long long2,
int int1,
String nodeName,
NodeAddress nodeAddress)
Constructor taking the full details for a remote Node connection |
Method Summary | |
---|---|
int |
compareTo(Object arg0)
Compares this NodeID with another NodeID. |
boolean |
equals(Object arg0)
Checks if the given object is equal to this NodeID |
NodeAddress |
getNodeAddress()
Gets the NodeAddress part of the NodeID |
int |
hashCode()
Returns the hashCode for this object |
static NodeID |
parse(String str)
Converts a string representation of a NodeID back to a NodeID object |
String |
toString()
Converts the NodeID into a string for communication with other implementations, or for display purposes. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public NodeID(long long1, long long2, int int1, String nodeName, NodeAddress nodeAddress)
long1
- The time component of the remote Nodelong2
- The memory component of the remote Nodeint1
- The hashCode component of the remote NodenodeName
- The name component of the remote NodenodeAddress
- The NodeAddress component of the remote NodeMethod Detail |
---|
public int compareTo(Object arg0)
compareTo
in interface Comparable
arg0
-
public boolean equals(Object arg0)
equals
in class Object
arg0
-
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public NodeAddress getNodeAddress()
public static NodeID parse(String str)
str
- The string version of a NodeID
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |