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

java.lang.Object
es.uam.eps.ir.relison.diffusion.selections.AbstractSelectionMechanism<U,​I,​P>
es.uam.eps.ir.relison.diffusion.selections.TimestampBasedSelectionMechanism<U,​I,​P>
es.uam.eps.ir.relison.diffusion.selections.LooseTimestampBasedSelectionMechanism<U,​I,​P>
Type Parameters:
U - type of the users.
I - type of the information pieces.
P - type of the parameters.
All Implemented Interfaces:
SelectionMechanism<U,​I,​P>

public class LooseTimestampBasedSelectionMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>
extends TimestampBasedSelectionMechanism<U,​I,​P>
Selection mechanism that takes the real timestamps of the users into account. Each own piece of information is released when the timestamp of the piece is equal to the timestamp of the simulation. No information pieces are repropagated. Information pieces from other users are propagated if they are received and the timestamp of the real propagation is smaller or equal than the current one.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private java.util.Map<U,​java.util.Set<java.lang.Integer>> notProp
    Map containing, for each user, the information pieces which should have been propagated in the past (originated in other users), but have not been propagated yet, because the piece was not previously received.
  • Constructor Summary

    Constructors 
    Constructor Description
    LooseTimestampBasedSelectionMechanism()  
  • Method Summary

    Modifier and Type Method Description
    protected java.util.List<PropagatedInformation> getReceivedInformation​(UserState<U> user, Data<U,​I,​P> data, SimulationState<U,​I,​P> state, int numIter, java.lang.Long timestamp)
    Obtains the list of received information pieces to repropagate.
    java.util.stream.Stream<U> getSelectableUsers​(Data<U,​I,​P> data, SimulationState<U,​I,​P> state, int numIter, java.lang.Long timestamp)
    Selects the users which can propagate information during the iteration.

    Methods inherited from class es.uam.eps.ir.relison.diffusion.selections.TimestampBasedSelectionMechanism

    getOwnInformation, getRepropagatedInformation

    Methods inherited from class es.uam.eps.ir.relison.diffusion.selections.AbstractSelectionMechanism

    select

    Methods inherited from class java.lang.Object

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

    • notProp

      private final java.util.Map<U extends java.io.Serializable,​java.util.Set<java.lang.Integer>> notProp
      Map containing, for each user, the information pieces which should have been propagated in the past (originated in other users), but have not been propagated yet, because the piece was not previously received.
  • Constructor Details

  • Method Details

    • getReceivedInformation

      protected java.util.List<PropagatedInformation> getReceivedInformation​(UserState<U> user, Data<U,​I,​P> data, SimulationState<U,​I,​P> state, int numIter, java.lang.Long timestamp)
      Description copied from class: AbstractSelectionMechanism
      Obtains the list of received information pieces to repropagate.
      Specified by:
      getReceivedInformation in class AbstractSelectionMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>
      Parameters:
      user - the user to analyze.
      data - the full data.
      state - the iteration number.
      numIter - number of the iteration.
      timestamp - the timestamp for the current simulation.
      Returns:
      a selection of the received information pieces to be propagated.
    • getSelectableUsers

      public java.util.stream.Stream<U> getSelectableUsers​(Data<U,​I,​P> data, SimulationState<U,​I,​P> state, int numIter, java.lang.Long timestamp)
      Description copied from interface: SelectionMechanism
      Selects the users which can propagate information during the iteration.
      Specified by:
      getSelectableUsers in interface SelectionMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>
      Overrides:
      getSelectableUsers in class AbstractSelectionMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>
      Parameters:
      data - the complete data.
      state - the current state of the simulation.
      numIter - iteration number.
      timestamp - the current timestamp.
      Returns:
      a stream containing the users who can propagate information.