Package org.jcsp.net
Class ChannelID
- java.lang.Object
-
- org.jcsp.net.ChannelID
-
- All Implemented Interfaces:
java.io.Serializable
class ChannelID extends java.lang.Object implements java.io.Serializable
-
-
Field Summary
Fields Modifier and Type Field Description private long
index
private NodeID
nodeID
private static java.lang.String
STRING_FORM_PREFIX
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static ChannelID
createFromStringForm(java.lang.String stringForm)
This returns a ChannelID created from its String form as returned by the getStringForm method.boolean
equals(java.lang.Object obj)
Compares two ChannelIDs for equality.long
getIndex()
Returns the channel's index number.NodeID
getNodeID()
Returns the channel's NodeID.(package private) java.lang.String
getStringForm()
This returns a String representation of this ChannelID.java.lang.String
toString()
Returns a human readable string representation of the current instance of this class.
-
-
-
Field Detail
-
nodeID
private NodeID nodeID
-
index
private long index
-
STRING_FORM_PREFIX
private static final java.lang.String STRING_FORM_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ChannelID
public ChannelID(NodeID nodeID, long index)
Creates a ChannelID for a channel.- Parameters:
nodeID
- The host node.index
- the channel index.
-
ChannelID
ChannelID(java.lang.String stringForm) throws java.lang.IllegalArgumentException
- Throws:
java.lang.IllegalArgumentException
-
-
Method Detail
-
createFromStringForm
static ChannelID createFromStringForm(java.lang.String stringForm) throws java.lang.IllegalArgumentException
This returns a ChannelID created from its String form as returned by the getStringForm method.- Parameters:
stringForm
- the String to use to create the ChannelID.- Returns:
- the recreated ChannelID.
- Throws:
java.lang.IllegalArgumentException
-
getStringForm
java.lang.String getStringForm()
This returns a String representation of this ChannelID. The ChannelID can be recreated by calling the createFromString method.- Returns:
- the String representing this ChannelID.
-
getNodeID
public final NodeID getNodeID()
Returns the channel's NodeID.- Returns:
- the channel's NodeID.
-
getIndex
public final long getIndex()
Returns the channel's index number.- Returns:
- the channel's index number.
-
equals
public final boolean equals(java.lang.Object obj)
Compares two ChannelIDs for equality.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- AnotherObject
to compare with thisObject
.- Returns:
- true iff obj is a non-null
ChannelID
which represents the same channel.
-
toString
public java.lang.String toString()
Returns a human readable string representation of the current instance of this class.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a human readable
String
object.
-
-