Package org.jcsp.net
Class NodeUI
java.lang.Object
org.jcsp.net.NodeUI
- All Implemented Interfaces:
Serializable,Comparable
- Direct Known Subclasses:
NodeUIImpl
A Unique Identifier for a Node.
This class is different from NodeID in that it does not describe the
Node's location.
Implementations of this class should provide a constructor that takes a
String parameter which is in the format of the String
returned from the getImplStringForm() method.
- Author:
- Quickstone Technologies Limited
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract booleancheckEqual(NodeUI other) An abstract method to be implemented to return whether anotherNodeUIobject is equal to this instance.final intCompares thisNodeUIwith another object.static final NodeUIcreateFromStringForm(String stringForm) Creates a NodeUI from a String in the format of that returned from thegetImplStringForm()method.final booleanCompares thisNodeUIwith another object.protected abstract StringThis is an abstract method that should be implemented to return aStringthat can be used by thecompareTo(Object)method in order to compare twoNodeUIobjects.protected abstract StringReturns aStringthat can be supplied to the staticcreateFromStringForm(String)method in order to create an equalNodeUIobject.abstract inthashCode()Returns aninthash code for this object.
-
Constructor Details
-
NodeUI
public NodeUI()
-
-
Method Details
-
getImplStringForm
Returns aStringthat can be supplied to the staticcreateFromStringForm(String)method in order to create an equalNodeUIobject.- Returns:
- a
Stringcontaining the necessary information to recreate thisNodeUIobject.
-
createFromStringForm
Creates a NodeUI from a String in the format of that returned from thegetImplStringForm()method.- Parameters:
stringForm- theStringto use in creating theNodeUIobject.- Returns:
- a newly created
NodeUIobject.
-
equals
Compares thisNodeUIwith another object. This method checks that the supplied object is aNodeUIobject and then calls the implementation of thecheckEqual(NodeUI)method and returns its result value as the result of this method. -
compareTo
Compares thisNodeUIwith another object. This method calls the implementation of thegetComparisonString()method on both thisNodeUIobject and theNodeUIobject supplied. TheStringclass'compareTo(Object)is used to perform the comparison. The method is called on theStringreturned by this object and theStringreturned by the other object is supplied as the parameter.- Specified by:
compareToin interfaceComparable- Parameters:
o- another object to compare with this object.- Returns:
- an
intvalue that follows the rules of thecompareTo(Object)method in theStringclass. - Throws:
ClassCastException- if the supplied object is not aNodeUIobject.
-
checkEqual
An abstract method to be implemented to return whether anotherNodeUIobject is equal to this instance. If the theNodeUIis of a different implementation class, the method should returnfalse.- Parameters:
other- aNodeUIto compare with thisNodeUI.- Returns:
trueiff the suppliedNodeUIis equal to this one.
-
getComparisonString
This is an abstract method that should be implemented to return aStringthat can be used by thecompareTo(Object)method in order to compare twoNodeUIobjects. TwoNodeUIobjects should return equalStringobjects iff the twoNodeUIobjects are equal.- Returns:
- a
Stringthat follows the above rules.
-
hashCode
public abstract int hashCode()Returns aninthash code for this object. TwoNodeUIobjects will return equal hash codes if the two objects are equal.
-