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.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract boolean
checkEqual
(NodeUI other) An abstract method to be implemented to return whether anotherNodeUI
object is equal to this instance.final int
Compares thisNodeUI
with another object.static final NodeUI
createFromStringForm
(String stringForm) Creates a NodeUI from a String in the format of that returned from thegetImplStringForm()
method.final boolean
Compares thisNodeUI
with another object.protected abstract String
This is an abstract method that should be implemented to return aString
that can be used by thecompareTo(Object)
method in order to compare twoNodeUI
objects.protected abstract String
Returns aString
that can be supplied to the staticcreateFromStringForm(String)
method in order to create an equalNodeUI
object.(package private) final String
abstract int
hashCode()
Returns anint
hash code for this object.
-
Constructor Details
-
NodeUI
public NodeUI()
-
-
Method Details
-
getStringForm
-
getImplStringForm
Returns aString
that can be supplied to the staticcreateFromStringForm(String)
method in order to create an equalNodeUI
object.- Returns:
- a
String
containing the necessary information to recreate thisNodeUI
object.
-
createFromStringForm
Creates a NodeUI from a String in the format of that returned from thegetImplStringForm()
method.- Parameters:
stringForm
- theString
to use in creating theNodeUI
object.- Returns:
- a newly created
NodeUI
object.
-
equals
Compares thisNodeUI
with another object. This method checks that the supplied object is aNodeUI
object and then calls the implementation of thecheckEqual(NodeUI)
method and returns its result value as the result of this method. -
compareTo
Compares thisNodeUI
with another object. This method calls the implementation of thegetComparisonString()
method on both thisNodeUI
object and theNodeUI
object supplied. TheString
class'compareTo(Object)
is used to perform the comparison. The method is called on theString
returned by this object and theString
returned by the other object is supplied as the parameter.- Specified by:
compareTo
in interfaceComparable
- Parameters:
o
- another object to compare with this object.- Returns:
- an
int
value that follows the rules of thecompareTo(Object)
method in theString
class. - Throws:
ClassCastException
- if the supplied object is not aNodeUI
object.
-
checkEqual
An abstract method to be implemented to return whether anotherNodeUI
object is equal to this instance. If the theNodeUI
is of a different implementation class, the method should returnfalse
.- Parameters:
other
- aNodeUI
to compare with thisNodeUI
.- Returns:
true
iff the suppliedNodeUI
is equal to this one.
-
getComparisonString
This is an abstract method that should be implemented to return aString
that can be used by thecompareTo(Object)
method in order to compare twoNodeUI
objects. TwoNodeUI
objects should return equalString
objects iff the twoNodeUI
objects are equal.- Returns:
- a
String
that follows the above rules.
-
hashCode
public abstract int hashCode()Returns anint
hash code for this object. TwoNodeUI
objects will return equal hash codes if the two objects are equal.
-