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 DomainIDThe Domain of which the Node represented by this NodeID is a member.private StringA name assigned to this Node.private NodeUIA unique identifier for this node.private HashSetThis 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) voidaddAddress(NodeAddressID addressID) clone()Returns a clone of the instance ofNodeIDon which this method is being called.intCompares thisNodeIDobject with anotherNodeIDobject.intThis method is equivalent to calling thecompareTo(Object)and supplying the local Node'sNodeIDas a parameter.(package private) static NodeIDcreateFromStringForm(String stringForm) Deprecated.Not needed now channel names have been abstractedbooleanCompares thisNodeIDwith another object.Returns a clone of the set ofNodeAddressIDobjects that thisNodeIDholds.Get theDomainIDof the domain to which the Node represented by thisNodeIDobject belongs.getName()Returns a name that has been assigned to the Node represented by thisNodeIDobject.Returns this instance's parentAbstractIDobject.(package private) StringDeprecated.Not needed now channel names have been abstractedinthashCode()Returns a hash code for thisNodeIDobject.(package private) booleanonSameBranch(AbstractID abstractID) This tests whether another ID is on the same branch of a hierachy.private void(package private) voidremoveAddress(NodeAddressID addressID) (package private) voidsetDomainID(DomainID domainID) (package private) voidtoString()Returns a human readableStringthat represents thisNodeIDobject.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
NodeIDon which this method is being called.- Overrides:
clonein classObject- Returns:
- a clone of the current instance of
NodeID. - Throws:
CloneNotSupportedException- if theNodeIDcannot be cloned.
-
equals
Compares this
NodeIDwith another object. This will only return true if the other object is aNodeIDrepresenting the same Node as thisNodeID. The comparison is performed by using a Node's unique identifier. This was introduced for efficiency reasons as comparing twoNodeIDobjects' sets of addresses could be quite slow. -
hashCode
public int hashCode()Returns a hash code for this
NodeIDobject. -
compareTo
Compares this
NodeIDobject with anotherNodeIDobject. Returns 0 if thisNodeIDis equal to the otherNodeID, a negativeintif thisNodeIDis less than the suppliedNodeIDor a positiveintif thisNodeIDis greater than the suppliedNodeID.This comparison is based upon the implementation of
NodeUIused.- Specified by:
compareToin interfaceComparable- Parameters:
o- An object to compare with thisNodeID.- Returns:
- 0 if this
NodeIDis equal to the otherNodeID, a negativeintif thisNodeIDis less than the suppliedNodeIDor a positiveintif thisNodeIDis 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'sNodeIDas a parameter.- Returns:
- an
intfollowing the rules of thecompareTo(Object)method.
-
onSameBranch
Description copied from class:AbstractIDThis 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:
onSameBranchin classAbstractID- Returns:
- a
booleanindicating whether or not the supplied object is on the same branch.
-
getAddresses
Returns a clone of the set of
NodeAddressIDobjects that thisNodeIDholds.If any held
NodeAddressIDobjects do not support cloning, then the actual object is returned but this should never be the case.- Returns:
- an array of
NodeAddressIDobjects.
-
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:AbstractIDReturns this instance's parentAbstractIDobject.- Specified by:
getParentIDin classAbstractID- Returns:
- the parent
AbstractIDof this object.
-
getDomainID
Get theDomainIDof the domain to which the Node represented by thisNodeIDobject belongs. If the Node is not a member of a domain then aDomainIDobject will be returned that will returntruewhen itsisNullDomain()method is called.- Returns:
- this
NodeIDobject'sDomainIDobject.
-
getName
Returns a name that has been assigned to the Node represented by thisNodeIDobject. If no name has been assigned, then an emptyStringis returned. The Node naming feature is not currently implemented.- Returns:
- the name assigned to this
NodeIDobject's Node.
-
toString
Returns a human readableStringthat represents thisNodeIDobject. This will either include the name of the Node, if assigned, or else a list of the Node's addresses. TheStringreturned 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:
IOExceptionClassNotFoundException
-
writeObject
- Throws:
IOException
-