Package org.jcsp.net

Class GlobalID

All Implemented Interfaces:
Serializable

public final class GlobalID extends AbstractID implements 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 parent AbstractID to all top level DomainID objects.

See AbstractID for a fully explanation of this class.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final GlobalID
    A static instance of GlobalID.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compares another object with this GlobalID object.
    Returns null as there is no parent AbstractID of instances of this class.
    int
    Returns an int hash code for this object.
    (package private) boolean
    This tests whether another ID is on the same branch of a hierachy.
    Returns a human readable string representation of a GlobalID.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • instance

      public static final GlobalID instance

      A static instance of GlobalID. Instead of creating GlobalID objects, it is better to use this instance as only once instance is ever required.

  • Constructor Details

    • GlobalID

      public GlobalID()
  • Method Details

    • getParentID

      public AbstractID getParentID()

      Returns null as there is no parent AbstractID of instances of this class.

      Specified by:
      getParentID in class AbstractID
      Returns:
      null.
    • equals

      public boolean equals(Object o)

      Compares another object with this GlobalID object.

      Overrides:
      equals in class Object
      Parameters:
      o - an object to compare with object.
      Returns:
      true iff the other object is a GlobalID.
    • hashCode

      public int hashCode()

      Returns an int hash code for this object.

      Overrides:
      hashCode in class Object
      Returns:
      an int hash code.
    • toString

      public String toString()

      Returns a human readable string representation of a GlobalID.

      Overrides:
      toString in class 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 class AbstractID
      Returns:
      a boolean indicating whether or not the supplied object is on the same branch.