Package org.jcsp.net
Class NodeUI
- java.lang.Object
-
- org.jcsp.net.NodeUI
-
- All Implemented Interfaces:
Serializable,Comparable
- Direct Known Subclasses:
NodeUIImpl
public abstract class NodeUI extends Object implements Serializable, Comparable
A Unique Identifier for a Node. This class is different from
NodeIDin that it does not describe the Node's location.Implementations of this class should provide a constructor that takes a
Stringparameter which is in the format of theStringreturned from thegetImplStringForm()method.- Author:
- Quickstone Technologies Limited
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NodeUI()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract booleancheckEqual(NodeUI other)An abstract method to be implemented to return whether anotherNodeUIobject is equal to this instance.intcompareTo(Object o)Compares thisNodeUIwith another object.static NodeUIcreateFromStringForm(String stringForm)Creates a NodeUI from a String in the format of that returned from thegetImplStringForm()method.booleanequals(Object o)Compares thisNodeUIwith another object.protected abstract StringgetComparisonString()This 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 StringgetImplStringForm()Returns aStringthat can be supplied to the staticcreateFromStringForm(String)method in order to create an equalNodeUIobject.abstract inthashCode()Returns aninthash code for this object.
-
-
-
Method Detail
-
getImplStringForm
protected abstract String 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
public static final NodeUI createFromStringForm(String stringForm)
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
public final boolean equals(Object o)
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
public final int compareTo(Object o) throws ClassCastException
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
protected abstract boolean checkEqual(NodeUI other)
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
protected abstract String 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.
-
-