Class MagellanIdentifiableImpl

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected ID id
      The object imposing the unique identifiability.
    • Constructor Summary

      Constructors 
      Constructor Description
      MagellanIdentifiableImpl​(ID id)
      Creates a new identifiable object with the specified id.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone()
      Returns a copy of this object identified by a copy of the orignial's id.
      int compareTo​(java.lang.Object o)
      Imposes a natural ordering on Identifiable objects.
      boolean equals​(java.lang.Object o)
      Indicates that this object is to be regarded as equal to some other object.
      ID getID()
      Returns the id uniquely identifying this object.
      int hashCode()
      As we want to use the hashCode/equals contract we need to force the implementation of hashCode.
      int superHashCode()
      Returns Object's hash code.
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • id

        protected final ID id
        The object imposing the unique identifiability. This is immutable.
    • Constructor Detail

      • MagellanIdentifiableImpl

        public MagellanIdentifiableImpl​(ID id)
        Creates a new identifiable object with the specified id.
        Parameters:
        id - ID of the Identifiable
        Throws:
        java.lang.NullPointerException - if ID is null
    • Method Detail

      • getID

        public ID getID()
        Returns the id uniquely identifying this object.
        Specified by:
        getID in interface Identifiable
        Specified by:
        getID in interface Unique
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Returns a copy of this object identified by a copy of the orignial's id. I.e., the following statement holds true: this.getID() != this.clone().getID()
        Specified by:
        clone in interface Identifiable
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException - DOCUMENT-ME
      • equals

        public boolean equals​(java.lang.Object o)
        Indicates that this object is to be regarded as equal to some other object. Especially with implementing sub classes of Identifiable, equality will often be established through the equality of IDs.

        Attention: Overriding this method could break the general contract of equals!

        Specified by:
        equals in interface Identifiable
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • hashCode

        public int hashCode()
        As we want to use the hashCode/equals contract we need to force the implementation of hashCode.
        Specified by:
        hashCode in interface Identifiable
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hashCode of the current object
      • superHashCode

        public int superHashCode()
        Returns Object's hash code.
      • compareTo

        public int compareTo​(java.lang.Object o)
        Imposes a natural ordering on Identifiable objects. Especially with implementing sub classes of Identifiable, such orderings will often be established by the natural order of ids.

        Attention: Overriding this method could break the general contract of equals!

        Specified by:
        compareTo in interface java.lang.Comparable<java.lang.Object>
        Specified by:
        compareTo in interface Identifiable
        See Also:
        Identifiable.compareTo(java.lang.Object)