Package org.jcsp.net
Class GlobalID
- java.lang.Object
-
- org.jcsp.net.AbstractID
-
- org.jcsp.net.GlobalID
-
- All Implemented Interfaces:
java.io.Serializable
public final class GlobalID extends AbstractID implements java.io.Serializable
A Class whose instances represent the global domain. There is only ever a need to have one instance of this class per JVM so a static instance is supplied.
The
GlobalID
object is the parentAbstractID
to all top levelDomainID
objects.See
for a fully explanation of this class.AbstractID
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GlobalID()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
Compares another object with thisGlobalID
object.AbstractID
getParentID()
Returnsnull
as there is no parentAbstractID
of instances of this class.int
hashCode()
Returns anint
hash code for this object.(package private) boolean
onSameBranch(AbstractID abstractID)
This tests whether another ID is on the same branch of a hierachy.java.lang.String
toString()
Returns a human readable string representation of aGlobalID
.
-
-
-
Field Detail
-
instance
public static final GlobalID instance
A static instance of
GlobalID
. Instead of creatingGlobalID
objects, it is better to use this instance as only once instance is ever required.
-
-
Method Detail
-
getParentID
public AbstractID getParentID()
Returns
null
as there is no parentAbstractID
of instances of this class.- Specified by:
getParentID
in classAbstractID
- Returns:
null
.
-
equals
public boolean equals(java.lang.Object o)
Compares another object with this
GlobalID
object.- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- an object to compare with object.- Returns:
true
iff the other object is aGlobalID
.
-
hashCode
public int hashCode()
Returns an
int
hash code for this object.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- an
int
hash code.
-
toString
public java.lang.String toString()
Returns a human readable string representation of a
GlobalID
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- The human readable
String
- currently "Global".
-
onSameBranch
boolean onSameBranch(AbstractID abstractID)
Description copied from class:AbstractID
This tests whether another ID is on the same branch of a hierachy. Returns true if either the supplied object is a child (or a child of child etc.) of this object or if the supplied object is a parent (or a parent of a parent etc.) of this object.- Specified by:
onSameBranch
in classAbstractID
- Returns:
- a
boolean
indicating whether or not the supplied object is on the same branch.
-
-