Class NodeAddressID
- java.lang.Object
-
- org.jcsp.net.NodeAddressID
-
- All Implemented Interfaces:
Serializable,Cloneable
- Direct Known Subclasses:
TCPIPAddressID
public abstract class NodeAddressID extends Object implements Serializable, Cloneable
JCSP.NET communication protocol implementations must provide a concrete implementation of this class. The instances of the class implementations should hold address information for JCSP Node
LinkServerprocesses. For example, a TCP/IP implementation would most likely hold an IP address and port number.There is no defined way in this class as to how
NodeAddressIDobjects should be created. The JCSP infrastructure never looks at the underlying address information, it simply needs to be able compare one address with another. Theequals(Object)should be implemented in such a way that this can be achieved.Implementations of the
ProtocolIDclass should implement thecreateAddressID(String, boolean)method so thatNodeAddressIDobjects for that protocol can be created from aString. Theboolean parameterindicates whether or not the address is globally unique.- Author:
- Quickstone Technologies Limited
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NodeAddressID()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Objectclone()Returns a clone of the instance of the class implementing this interface.abstract booleanequals(Object obj)Compares the instance of the class implementing this interface with another object.protected static NodeAddressIDgetAddressIDFromString(String stringForm)This is is a static method that should be overriden by concrete implementations of this class.abstract ProtocolIDgetProtocolID()Returns theProtocolIDfor the protocol that is associated with thisNodeAddressID.protected abstract StringgetStringForm()Deprecated.This is going to be removed from the API.abstract inthashCode()Returns a hash code for this object.abstract booleanisGloballyUnique()Returnstrueif thisNodeAddressIDis known to be unique within the global org.jcsp.net domain.
-
-
-
Method Detail
-
equals
public abstract boolean equals(Object obj)
Compares the instance of the class implementing this interface with another object. This should return
trueif the other object represents the same address.
-
hashCode
public abstract int hashCode()
Returns a hash code for this object. Two
NodeAddressIDobjects should return the same hash code if they equal as governed by the rules for theequals(Object)method.
-
clone
public Object clone() throws CloneNotSupportedException
Returns a clone of the instance of the class implementing this interface.
- Overrides:
clonein classObject- Returns:
- a clone of the object that this is being called on.
- Throws:
CloneNotSupportedException- if the implementation class does not support the clone method.
-
getProtocolID
public abstract ProtocolID getProtocolID()
Returns theProtocolIDfor the protocol that is associated with thisNodeAddressID.- Returns:
- this
NodeAddressIDobject'sProtocolID.
-
isGloballyUnique
public abstract boolean isGloballyUnique()
Returns
trueif thisNodeAddressIDis known to be unique within the global org.jcsp.net domain.A Node may have several addresses. If a Node is on an internal network that is connected to the Internet, it may have one local address and one address that is accessible from the Internet. The Internet address may be globally unique whereas the local address may be duplicated in other internal networks. The
NodeAddressIDobject representing the Internet address should returntruewhen this method is called whereas theNodeAddressIDrepresenting the local address should returnfalse.- Returns:
trueiff thisNodeAddressIDis globally unique.
-
getStringForm
protected abstract String getStringForm()
Deprecated.This is going to be removed from the API. The purpose of this mechanism was so that channel information could be encoded into anonymous channels' channel names.Returns a
Stringthat contains all information necessary for reconstucting this object from aString. The object is reconstructed by calling the staticgetAddressIDFromString(String)method.- Returns:
- a
Stringthat can be passed to the staticgetAddressIDFromString(String)method in order to reconstuct the object.
-
getAddressIDFromString
protected static NodeAddressID getAddressIDFromString(String stringForm) throws IllegalArgumentException
This is is a static method that should be overriden by concrete implementations of this class. Ideally this method would be abstract but the language does not allow abstract static methods.
The method constructs a
NodeAddressIDobject from aStringthat is in the form of that returned by thegetStringForm()method. The object returned by this method should equal the object that returned theStringwhen itsgetStringForm()methdo was called.- Parameters:
stringForm- theStringused to construct theNodeAddressID.- Returns:
- a newly constructed
NodeAddressIDobject. - Throws:
IllegalArgumentException- if theStringsupplied is invalid.
-
-