|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.iperg.part.core.IpIdentifier
public class IpIdentifier
The IpIdentifier
class represents identifiers that may
be unique in time and space. That is, an instance of the
IpIdentifier
class that is created at a specific time
by an IPerG process can be made unique in relation to all other
IpIdentifier
instances created by other IPerG
processes at any time.
Depending on the way in which IpIdentifier
instances are
created, they may or may not be unique. For instance, using the empty
constructor will create an identifier that is not unique in time and
space:
IpIdentifier id = new IpIdentifier();An identifier can be made unique by callings its
makeUnique
method.
id.makeUnique();
If an identifier is created by passing a byte stream to the constructor, the new identifier uniqueness wull dependend on the data encoded in the stream.
IpIdentifier id = new IpIdentifier(stream);
Constructor Summary | |
---|---|
IpIdentifier()
Create a new zero identifier which is NOT be unique. |
|
IpIdentifier(IpIdentifier srcId)
Create a new identifier which is a copy of another identifier. |
|
IpIdentifier(IpInputStream stream)
Create a new identifier by reading data from an input stream. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
Check if the identifier equals another object (identifier) |
static IpIdentifier |
fromString(java.lang.String s)
Return a new IpIdentifier initialised by a string
representation. |
int |
hashCode()
Return a hash value for the identifier. |
boolean |
isZero()
Check if the identifier is a "zero" identifier |
void |
makeReadOnly()
By making the object read only, its state can not be modified, e.g., by calling the read method. |
void |
makeUnique()
Make sure that the identifier is unique in time and space |
static IpIdentifier |
newUniqueId()
Create and return a new unique identifier instance. |
void |
read(IpInputStream stream)
Read the state of the process object from an input stream. |
void |
setIncarnation(short incarnation)
|
java.lang.String |
toString()
Return a string representation of a identifier |
void |
write(IpOutputStream stream)
Write the state of the process object into an putput stream . |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public IpIdentifier()
public IpIdentifier(IpIdentifier srcId)
srcId
- The identifier to copypublic IpIdentifier(IpInputStream stream) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public void makeUnique()
public void makeReadOnly()
read
method.
public boolean isZero()
true
if identifier is a zero identifier,
false
otherwisepublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The other object (identifier)
public void write(IpOutputStream stream)
write
in interface IpSerializable
stream
- The output stream into which the process object's
state should be written
java.io.IOException
- if an io exception occured while writing
the identifier to the streampublic void read(IpInputStream stream)
read
in interface IpSerializable
stream
- The input stream object from which the process
object's state should be read
java.io.IOException
- if marshalling failedpublic java.lang.String toString()
toString
in class java.lang.Object
public static IpIdentifier fromString(java.lang.String s)
IpIdentifier
initialised by a string
representation. The string must have been returned from the
toString
method:
IpIdentifier id1 = new IpIdentifier(); IpIdentifier id2 = IpIdentifier.fromString(id1.toString());
null
if string
could not be parsedpublic static IpIdentifier newUniqueId()
public int hashCode()
hashCode
in class java.lang.Object
public void setIncarnation(short incarnation)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |