Class TimedExpirationMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>

java.lang.Object
es.uam.eps.ir.relison.diffusion.expiration.TimedExpirationMechanism<U,​I,​P>
Type Parameters:
U - type of the users.
I - type of the information.
P - type of the parameters.
All Implemented Interfaces:
ExpirationMechanism<U,​I,​P>

public class TimedExpirationMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>
extends java.lang.Object
implements ExpirationMechanism<U,​I,​P>
Expiration mechanism that discards information pieces after a certain number of iterations.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    long maxTime
    Time before expiration.
  • Constructor Summary

    Constructors 
    Constructor Description
    TimedExpirationMechanism​(long maxTime)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    java.util.stream.Stream<java.lang.Integer> expire​(UserState<U> user, Data<U,​I,​P> data, int numIter, java.lang.Long timestamp)
    Obtains the information that has expired in the current iteration.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • maxTime

      public final long maxTime
      Time before expiration.
  • Constructor Details

    • TimedExpirationMechanism

      public TimedExpirationMechanism​(long maxTime)
      Constructor.
      Parameters:
      maxTime - Time before expiration of the information piece.
  • Method Details

    • expire

      public java.util.stream.Stream<java.lang.Integer> expire​(UserState<U> user, Data<U,​I,​P> data, int numIter, java.lang.Long timestamp)
      Description copied from interface: ExpirationMechanism
      Obtains the information that has expired in the current iteration.
      Specified by:
      expire in interface ExpirationMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>
      Parameters:
      user - UserState to check.
      data - The full data.
      numIter - Current iteration.
      timestamp - moment of time represented by the iteration.
      Returns:
      A stream with the identifiers of all the received information pieces that have expired.