Class AbstractSelectionMechanism<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>
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>
Direct Known Subclasses:
CountSelectionMechanism, TimestampBasedSelectionMechanism

public abstract class AbstractSelectionMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>
extends java.lang.Object
implements SelectionMechanism<U,​I,​P>
Abstract implementation of a selection mechanism.
  • Constructor Details

  • Method Details

    • select

      public Selection select​(UserState<U> user, Data<U,​I,​P> data, SimulationState<U,​I,​P> state, int numIter, java.lang.Long timestamp)
      Description copied from interface: SelectionMechanism
      Given a user, selects the information pieces that he/she propagates during this iteration.
      Specified by:
      select in interface SelectionMechanism<U extends java.io.Serializable,​I extends java.io.Serializable,​P>
      Parameters:
      user - the user to analyze.
      data - the complete data.
      state - the current state of the simulation.
      numIter - the iteration number.
      timestamp - the current timestamp.
      Returns:
      a selection of information pieces to be propagated.
    • getOwnInformation

      protected abstract java.util.List<PropagatedInformation> getOwnInformation​(UserState<U> user, Data<U,​I,​P> data, SimulationState<U,​I,​P> state, int numIter, java.lang.Long timestamp)
      Obtains the list of own information pieces to repropagate.
      Parameters:
      user - the user to analyze.
      data - the full data.
      state - current simulation state.
      numIter - the iteration number.
      timestamp - the timestamp for the current simulation.
      Returns:
      a selection of the own information pieces to be propagated.
    • getReceivedInformation

      protected abstract 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.
      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.
    • getRepropagatedInformation

      protected abstract java.util.List<PropagatedInformation> getRepropagatedInformation​(UserState<U> user, Data<U,​I,​P> data, SimulationState<U,​I,​P> state, int numIter, java.lang.Long timestamp)
      Obtains the list of propagated information pieces to repropagate.
      Parameters:
      user - the user to analyze.
      data - the full data.
      state - current simulation state.
      numIter - number of the iteration.
      timestamp - the timestamp for the current simulation.
      Returns:
      a selection of the information pieces to repropagate.
    • 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>
      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.