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
GlobalIDobject is the parentAbstractIDto all top levelDomainIDobjects.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 booleanequals(java.lang.Object o)Compares another object with thisGlobalIDobject.AbstractIDgetParentID()Returnsnullas there is no parentAbstractIDof instances of this class.inthashCode()Returns aninthash code for this object.(package private) booleanonSameBranch(AbstractID abstractID)This tests whether another ID is on the same branch of a hierachy.java.lang.StringtoString()Returns a human readable string representation of aGlobalID.
-
-
-
Field Detail
-
instance
public static final GlobalID instance
A static instance of
GlobalID. Instead of creatingGlobalIDobjects, it is better to use this instance as only once instance is ever required.
-
-
Method Detail
-
getParentID
public AbstractID getParentID()
Returns
nullas there is no parentAbstractIDof instances of this class.- Specified by:
getParentIDin classAbstractID- Returns:
null.
-
equals
public boolean equals(java.lang.Object o)
Compares another object with this
GlobalIDobject.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- an object to compare with object.- Returns:
trueiff the other object is aGlobalID.
-
hashCode
public int hashCode()
Returns an
inthash code for this object.- Overrides:
hashCodein classjava.lang.Object- Returns:
- an
inthash code.
-
toString
public java.lang.String toString()
Returns a human readable string representation of a
GlobalID.- Overrides:
toStringin classjava.lang.Object- Returns:
- The human readable
String- currently "Global".
-
onSameBranch
boolean onSameBranch(AbstractID abstractID)
Description copied from class:AbstractIDThis 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:
onSameBranchin classAbstractID- Returns:
- a
booleanindicating whether or not the supplied object is on the same branch.
-
-