Class NodeID
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable
A Class whose instances represent a unique identifier for a JCSP.NET Node.
For an explanation of this class, see
.
AbstractID
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate NodeAddressID[]
This is a set of addresses of LinkServers that the Node, represented by this NodeID, is running.private DomainID
The Domain of which the Node represented by this NodeID is a member.private String
A name assigned to this Node.private NodeUI
A unique identifier for this node.private HashSet
This is the set of addresses of LinkServers that the Node, represented by this NodeID, is running but this JVM does not recognise. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
addAddress
(NodeAddressID addressID) clone()
Returns a clone of the instance ofNodeID
on which this method is being called.int
Compares thisNodeID
object with anotherNodeID
object.int
This method is equivalent to calling thecompareTo(Object)
and supplying the local Node'sNodeID
as a parameter.(package private) static NodeID
createFromStringForm
(String stringForm) Deprecated.Not needed now channel names have been abstractedboolean
Compares thisNodeID
with another object.Returns a clone of the set ofNodeAddressID
objects that thisNodeID
holds.Get theDomainID
of the domain to which the Node represented by thisNodeID
object belongs.getName()
Returns a name that has been assigned to the Node represented by thisNodeID
object.Returns this instance's parentAbstractID
object.(package private) String
Deprecated.Not needed now channel names have been abstractedint
hashCode()
Returns a hash code for thisNodeID
object.(package private) boolean
onSameBranch
(AbstractID abstractID) This tests whether another ID is on the same branch of a hierachy.private void
(package private) void
removeAddress
(NodeAddressID addressID) (package private) void
setDomainID
(DomainID domainID) (package private) void
toString()
Returns a human readableString
that represents thisNodeID
object.private void
-
Field Details
-
addressIDs
This is a set of addresses of LinkServers that the Node, represented by this NodeID, is running. -
unrecognisedAddressIDs
This is the set of addresses of LinkServers that the Node, represented by this NodeID, is running but this JVM does not recognise. The serialized forms of the addresses are stored here so that -
domainID
The Domain of which the Node represented by this NodeID is a member. -
nodeUI
A unique identifier for this node. -
name
A name assigned to this Node.
-
-
Constructor Details
-
NodeID
NodeID(NodeUI nodeUI) -
NodeID
NodeID(NodeUI nodeUI, NodeAddressID addressID, DomainID domainID) -
NodeID
NodeID(NodeUI nodeUI, NodeAddressID[] addressIDs, DomainID domainID) -
NodeID
- Throws:
IllegalArgumentException
-
-
Method Details
-
clone
Returns a clone of the instance of
NodeID
on which this method is being called.- Overrides:
clone
in classObject
- Returns:
- a clone of the current instance of
NodeID
. - Throws:
CloneNotSupportedException
- if theNodeID
cannot be cloned.
-
equals
Compares this
NodeID
with another object. This will only return true if the other object is aNodeID
representing the same Node as thisNodeID
. The comparison is performed by using a Node's unique identifier. This was introduced for efficiency reasons as comparing twoNodeID
objects' sets of addresses could be quite slow. -
hashCode
public int hashCode()Returns a hash code for this
NodeID
object. -
compareTo
Compares this
NodeID
object with anotherNodeID
object. Returns 0 if thisNodeID
is equal to the otherNodeID
, a negativeint
if thisNodeID
is less than the suppliedNodeID
or a positiveint
if thisNodeID
is greater than the suppliedNodeID
.This comparison is based upon the implementation of
NodeUI
used.- Specified by:
compareTo
in interfaceComparable
- Parameters:
o
- An object to compare with thisNodeID
.- Returns:
- 0 if this
NodeID
is equal to the otherNodeID
, a negativeint
if thisNodeID
is less than the suppliedNodeID
or a positiveint
if thisNodeID
is greater than the suppliedNodeID
. - Throws:
ClassCastException
- if the parameter supplied is not aNodeID
.
-
compareToLocalNode
public int compareToLocalNode()This method is equivalent to calling the
compareTo(Object)
and supplying the local Node'sNodeID
as a parameter.- Returns:
- an
int
following the rules of thecompareTo(Object)
method.
-
onSameBranch
Description copied from class:AbstractID
This tests whether another ID is on the same branch of a hierachy. Returns true if either the supplied object is a child (or a child of child etc.) of this object or if the supplied object is a parent (or a parent of a parent etc.) of this object.- Specified by:
onSameBranch
in classAbstractID
- Returns:
- a
boolean
indicating whether or not the supplied object is on the same branch.
-
getAddresses
Returns a clone of the set of
NodeAddressID
objects that thisNodeID
holds.If any held
NodeAddressID
objects do not support cloning, then the actual object is returned but this should never be the case.- Returns:
- an array of
NodeAddressID
objects.
-
addAddress
-
removeAddress
-
createFromStringForm
Deprecated.Not needed now channel names have been abstracted- Throws:
IllegalArgumentException
-
getStringForm
String getStringForm()Deprecated.Not needed now channel names have been abstractedThis gets a String form of this NodeID. This is only intended to be called for NodeID's representing the current JVM as any NodeAddressIDs in serialized form in the unrecognisedAddressIDs HashSet will not be saved. This HashSet should be empty for NodeID's representing the current JVM.- Returns:
- the String form that can be used to reconstruct this NodeID.
-
setDomainID
-
getParentID
Description copied from class:AbstractID
Returns this instance's parentAbstractID
object.- Specified by:
getParentID
in classAbstractID
- Returns:
- the parent
AbstractID
of this object.
-
getDomainID
Get theDomainID
of the domain to which the Node represented by thisNodeID
object belongs. If the Node is not a member of a domain then aDomainID
object will be returned that will returntrue
when itsisNullDomain()
method is called.- Returns:
- this
NodeID
object'sDomainID
object.
-
getName
Returns a name that has been assigned to the Node represented by thisNodeID
object. If no name has been assigned, then an emptyString
is returned. The Node naming feature is not currently implemented.- Returns:
- the name assigned to this
NodeID
object's Node.
-
toString
Returns a human readableString
that represents thisNodeID
object. This will either include the name of the Node, if assigned, or else a list of the Node's addresses. TheString
returned by this method is only really intended as a way of supply debugging information to users. The contents is not guaranteed and should not relied upon by a program. -
setName
-
readObject
- Throws:
IOException
ClassNotFoundException
-
writeObject
- Throws:
IOException
-