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
- Author:
- Quickstone Technologies Limited
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionclone()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.booleanCompares 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.inthashCode()Returns a hash code for thisNodeIDobject.toString()Returns a human readableStringthat represents thisNodeIDobject.
-
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.
-
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.
-
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.
-