Class Information<I>

java.lang.Object
es.uam.eps.ir.relison.diffusion.data.Information<I>
Type Parameters:
I - type of the information id
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
PropagatedInformation

public class Information<I>
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
Piece of information.
See Also:
Serialized Form
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private I infoId
    Unique identifier of a piece of information.
    private long timestamp
    Time of creation of the information / Time of arrival.
  • Constructor Summary

    Constructors 
    Constructor Description
    Information​(I infoId, long timestamp)
    Creates a basic piece of information.
  • Method Summary

    Modifier and Type Method Description
    Information<I> clone()  
    boolean equals​(java.lang.Object object)
    Checks if two elements are equal.
    I getInfoId()
    Obtains the information identifier.
    long getTimestamp()
    Obtains the timestamp of the piece.
    int hashCode()  
    void setTimestamp​(long timestamp)
    Modifies the timestamp of the piece.

    Methods inherited from class java.lang.Object

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

    • infoId

      private final I infoId
      Unique identifier of a piece of information.
    • timestamp

      private long timestamp
      Time of creation of the information / Time of arrival.
  • Constructor Details

    • Information

      public Information​(I infoId, long timestamp)
      Creates a basic piece of information.
      Parameters:
      infoId - Information id.
      timestamp - Time of creation of the information / Time of arrival.
  • Method Details

    • getInfoId

      public I getInfoId()
      Obtains the information identifier.
      Returns:
      The identifier of the information.
    • getTimestamp

      public long getTimestamp()
      Obtains the timestamp of the piece.
      Returns:
      The timestamp.
    • setTimestamp

      public void setTimestamp​(long timestamp)
      Modifies the timestamp of the piece.
      Parameters:
      timestamp - the new timestamp.
    • equals

      public boolean equals​(java.lang.Object object)
      Checks if two elements are equal. It only compares the information piece identifier.
      Overrides:
      equals in class java.lang.Object
      Parameters:
      object - the object to check equality with.
      Returns:
      true if the object is an information piece and the ids are equal, false if not.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • clone

      public Information<I> clone() throws java.lang.CloneNotSupportedException
      Overrides:
      clone in class java.lang.Object
      Throws:
      java.lang.CloneNotSupportedException