Class SimpleIteration<U,​I,​P>

java.lang.Object
es.uam.eps.ir.relison.diffusion.simulation.SimpleIteration<U,​I,​P>
Type Parameters:
U - Type of the users.
I - Type of the information pieces.
P - Type of the features.
All Implemented Interfaces:
Iteration<U,​I,​P>

public class SimpleIteration<U,​I,​P>
extends java.lang.Object
implements Iteration<U,​I,​P>
Class for storing the basic information of a simulation iteration.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private java.util.Map<U,​java.util.List<I>> discardedPieces
    The set of discarded information pieces observed by each user.
    private int iterationNumber
    Number of the current iteration.
    private int numDiscarded
    Number of discarded information pieces
    private int numDiscardingUsers
    Number of users which have discarded, at least, one information piece.
    private int numPropagated
    Number of propagated information pieces
    private int numPropagatingUsers
    Number of users which have propagated, at least, one information piece
    private int numReceivingUsers
    Number of users which have read, at least, a new information piece.
    private int numReReceived
    Total re-read information pieces for the whole set of users.
    private int numReReceivingUsers
    Number of users which have read, at least, one information piece which they had read in a previous iteration.
    private int numSeen
    Total newly observed pieces for the whole set of users.
    private int numUniqueReReceived
    Sum of the number of unique re-read information pieces of each user.
    private int numUniqueSeen
    Sum of the number of different newly observed pieces by each user
    private java.util.Map<U,​java.util.List<I>> propagatedPieces
    The set of propagated pieces by each user.
    private java.util.Map<U,​java.util.Map<I,​java.util.Set<U>>> rereceivedPieces
    The set of re-received information pieces observed by each user (and their creators).
    private java.util.Map<U,​java.util.Map<I,​java.util.Set<U>>> seenPieces
    The set of information pieces observed by each user (and their creators).
  • Constructor Summary

    Constructors 
    Constructor Description
    SimpleIteration​(int iterationNumber)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    boolean addDiscardingUser​(U u, java.util.List<I> discardedPieces)
    Adds the discarded pieces of a single user to the iteration
    boolean addPropagatingUser​(U u, java.util.List<I> propagatedPieces)
    Adds the propagated pieces of a single user to the iteration
    boolean addReceivingUser​(U u, java.util.Map<I,​java.util.Set<U>> seenPieces)
    Adds the received pieces of a single user to the iteration.
    boolean addReReceivingUser​(U u, java.util.Map<I,​java.util.Set<U>> rereceivedPieces)
    Adds the re-received pieces of a single user discarded pieces to the iteration
    java.util.stream.Stream<I> getDiscardedInformation​(U u)
    Obtains the set of information pieces that a given user has discarded during this iteration.
    java.util.stream.Stream<U> getDiscardingUsers()
    Obtains the set of users which have discarded, at least, one information piece during this iteration.
    int getIterationNumber()
    Obtains the iteration number.
    int getNumDiscarded()
    Obtains the total number of discarded information pieces.
    int getNumDiscarded​(U u)
    Obtains the total number of information pieces that a given user has discarded during this iteration.
    int getNumDiscardingUsers()
    Obtains the total number of users which have discarded information pieces.
    int getNumPropagated()
    Obtains the total number of propagated information pieces (it does not take into account how many people received them).
    int getNumPropagated​(U u)
    Obtains the total number of information pieces that a given user has propagated during this iteration.
    int getNumPropagatingUsers()
    Obtains the total number of users which have propagated information pieces.
    int getNumReceivingUsers()
    Obtains the number of users which have received and read new information in this iteration.
    int getNumReReceived()
    Obtains the total number of information pieces which have been read by the different users in the network after they had read them in previous iterations.
    int getNumReReceived​(U u)
    Obtains the total number of information pieces which have been seen by a user (considering that the user had read them before).
    int getNumReReceivingUsers()
    Obtains the number of users which have received and read information pieces they had read before.
    int getNumSeen()
    Obtains the total of number of information pieces which have been read by the different users in the network for the first time during this iteration.
    int getNumSeen​(U u)
    Obtains the total number of information pieces which have been read by a user in the network for the first time during this iteration.
    int getNumUniqueReReceived()
    Obtains the number of information pieces which have been read by a user in the network (without taking into acount how many times it has been received during this iteration), considering that the user had read them before.
    int getNumUniqueReReceived​(U u)
    Obtains the total number of different information pieces which have been read by a user in the network during this iteration after they were read in a previous iteration.
    int getNumUniqueSeen()
    Obtains the number of information pieces which have been read by a user in the network (without taking into acount how many times it has been received during this iteration).
    int getNumUniqueSeen​(U u)
    Obtains the total number of different information pieces which have been read by a user in the network for the first time during this iteration.
    java.util.stream.Stream<I> getPropagatedInformation​(U u)
    Obtains the set of information pieces that a given user has propagated during this iteration.
    java.util.stream.Stream<U> getPropagatingUsers()
    Obtains the set of users which have propagated, at least, one information piece during this iteration.
    java.util.stream.Stream<U> getReceivingUsers()
    Obtains the set of users which have received and read, at least, one piece of information which they had not read before.
    java.util.stream.Stream<Tuple2oo<I,​java.util.Set<U>>> getReReceivedInformation​(U u)
    Obtains the set of information that a given user read in previous iterations, and have been re-read in this one.
    java.util.stream.Stream<U> getReReceivingUsers()
    Obtains the set of users which have received and read, at least, one piece of information they had read before.
    java.util.stream.Stream<Tuple2oo<I,​java.util.Set<U>>> getSeenInformation​(U u)
    Obtains the set of information pieces that a given user has read for the first time during this iteration.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface es.uam.eps.ir.relison.diffusion.simulation.Iteration

    getTotalReceived, getTotalReceived
  • Field Details

    • iterationNumber

      private final int iterationNumber
      Number of the current iteration.
    • seenPieces

      private final java.util.Map<U,​java.util.Map<I,​java.util.Set<U>>> seenPieces
      The set of information pieces observed by each user (and their creators).
    • rereceivedPieces

      private final java.util.Map<U,​java.util.Map<I,​java.util.Set<U>>> rereceivedPieces
      The set of re-received information pieces observed by each user (and their creators).
    • propagatedPieces

      private final java.util.Map<U,​java.util.List<I>> propagatedPieces
      The set of propagated pieces by each user.
    • discardedPieces

      private final java.util.Map<U,​java.util.List<I>> discardedPieces
      The set of discarded information pieces observed by each user.
    • numUniqueSeen

      private int numUniqueSeen
      Sum of the number of different newly observed pieces by each user
    • numSeen

      private int numSeen
      Total newly observed pieces for the whole set of users.
    • numUniqueReReceived

      private int numUniqueReReceived
      Sum of the number of unique re-read information pieces of each user.
    • numReReceived

      private int numReReceived
      Total re-read information pieces for the whole set of users.
    • numPropagated

      private int numPropagated
      Number of propagated information pieces
    • numDiscarded

      private int numDiscarded
      Number of discarded information pieces
    • numReceivingUsers

      private int numReceivingUsers
      Number of users which have read, at least, a new information piece.
    • numReReceivingUsers

      private int numReReceivingUsers
      Number of users which have read, at least, one information piece which they had read in a previous iteration.
    • numPropagatingUsers

      private int numPropagatingUsers
      Number of users which have propagated, at least, one information piece
    • numDiscardingUsers

      private int numDiscardingUsers
      Number of users which have discarded, at least, one information piece.
  • Constructor Details

    • SimpleIteration

      public SimpleIteration​(int iterationNumber)
      Constructor.
      Parameters:
      iterationNumber - the number of the iteration.
  • Method Details

    • addReceivingUser

      public boolean addReceivingUser​(U u, java.util.Map<I,​java.util.Set<U>> seenPieces)
      Description copied from interface: Iteration
      Adds the received pieces of a single user to the iteration.
      Specified by:
      addReceivingUser in interface Iteration<U,​I,​P>
      Parameters:
      u - the user identifier.
      seenPieces - the list of pieces that this user has newly seen this iteration (and their authors).
      Returns:
      true if everything is OK, false if it is not.
    • addReReceivingUser

      public boolean addReReceivingUser​(U u, java.util.Map<I,​java.util.Set<U>> rereceivedPieces)
      Description copied from interface: Iteration
      Adds the re-received pieces of a single user discarded pieces to the iteration
      Specified by:
      addReReceivingUser in interface Iteration<U,​I,​P>
      Parameters:
      u - the user identifier.
      rereceivedPieces - the list of pieces that this user has re-received this iteration (and their authors).
      Returns:
      true if everything is OK, false if it is not.
    • addPropagatingUser

      public boolean addPropagatingUser​(U u, java.util.List<I> propagatedPieces)
      Description copied from interface: Iteration
      Adds the propagated pieces of a single user to the iteration
      Specified by:
      addPropagatingUser in interface Iteration<U,​I,​P>
      Parameters:
      u - the user identifier.
      propagatedPieces - the list of pieces that this user has propagated this iteration.
      Returns:
      true if everything is OK, false if it is not.
    • addDiscardingUser

      public boolean addDiscardingUser​(U u, java.util.List<I> discardedPieces)
      Description copied from interface: Iteration
      Adds the discarded pieces of a single user to the iteration
      Specified by:
      addDiscardingUser in interface Iteration<U,​I,​P>
      Parameters:
      u - the user identifier.
      discardedPieces - the list of pieces that this user has discarded this iteration.
      Returns:
      true if everything is OK, false if it is not.
    • getIterationNumber

      public int getIterationNumber()
      Description copied from interface: Iteration
      Obtains the iteration number.
      Specified by:
      getIterationNumber in interface Iteration<U,​I,​P>
      Returns:
      the iteration number.
    • getNumReceivingUsers

      public int getNumReceivingUsers()
      Description copied from interface: Iteration
      Obtains the number of users which have received and read new information in this iteration.
      Specified by:
      getNumReceivingUsers in interface Iteration<U,​I,​P>
      Returns:
      the number of users which have received and read new information in this iteration.
    • getNumSeen

      public int getNumSeen()
      Description copied from interface: Iteration
      Obtains the total of number of information pieces which have been read by the different users in the network for the first time during this iteration.
      Specified by:
      getNumSeen in interface Iteration<U,​I,​P>
      Returns:
      the number of newly seen information pieces.
    • getNumSeen

      public int getNumSeen​(U u)
      Description copied from interface: Iteration
      Obtains the total number of information pieces which have been read by a user in the network for the first time during this iteration.
      Specified by:
      getNumSeen in interface Iteration<U,​I,​P>
      Parameters:
      u - the user
      Returns:
      the number of information pieces which have been read by the user for the first time during this iteration.
    • getNumUniqueSeen

      public int getNumUniqueSeen()
      Description copied from interface: Iteration
      Obtains the number of information pieces which have been read by a user in the network (without taking into acount how many times it has been received during this iteration).
      Specified by:
      getNumUniqueSeen in interface Iteration<U,​I,​P>
      Returns:
      the number of newly seen information pieces (without frequency).
    • getNumUniqueSeen

      public int getNumUniqueSeen​(U u)
      Description copied from interface: Iteration
      Obtains the total number of different information pieces which have been read by a user in the network for the first time during this iteration.
      Specified by:
      getNumUniqueSeen in interface Iteration<U,​I,​P>
      Parameters:
      u - the user
      Returns:
      the number of different information pieces which have been read by the user for the first time during this iteration.
    • getReceivingUsers

      public java.util.stream.Stream<U> getReceivingUsers()
      Description copied from interface: Iteration
      Obtains the set of users which have received and read, at least, one piece of information which they had not read before.
      Specified by:
      getReceivingUsers in interface Iteration<U,​I,​P>
      Returns:
      a stream containing users which have received and read, at least, one piece of information which they had not read before.
    • getSeenInformation

      public java.util.stream.Stream<Tuple2oo<I,​java.util.Set<U>>> getSeenInformation​(U u)
      Description copied from interface: Iteration
      Obtains the set of information pieces that a given user has read for the first time during this iteration.
      Specified by:
      getSeenInformation in interface Iteration<U,​I,​P>
      Parameters:
      u - the user
      Returns:
      the set of information pieces that the user has read for the first time during this iteration.
    • getNumReReceivingUsers

      public int getNumReReceivingUsers()
      Description copied from interface: Iteration
      Obtains the number of users which have received and read information pieces they had read before.
      Specified by:
      getNumReReceivingUsers in interface Iteration<U,​I,​P>
      Returns:
      the number of users which have received and read information pieces they had read before.
    • getNumReReceived

      public int getNumReReceived()
      Description copied from interface: Iteration
      Obtains the total number of information pieces which have been read by the different users in the network after they had read them in previous iterations.
      Specified by:
      getNumReReceived in interface Iteration<U,​I,​P>
      Returns:
      the number of seen information pieces which had been read before.
    • getNumReReceived

      public int getNumReReceived​(U u)
      Description copied from interface: Iteration
      Obtains the total number of information pieces which have been seen by a user (considering that the user had read them before).
      Specified by:
      getNumReReceived in interface Iteration<U,​I,​P>
      Parameters:
      u - the user.
      Returns:
      the total number of information pieces which have been seen by the user (considering that the user had read them before).
    • getNumUniqueReReceived

      public int getNumUniqueReReceived()
      Description copied from interface: Iteration
      Obtains the number of information pieces which have been read by a user in the network (without taking into acount how many times it has been received during this iteration), considering that the user had read them before.
      Specified by:
      getNumUniqueReReceived in interface Iteration<U,​I,​P>
      Returns:
      the number of seen information pieces (without frequency) which had been read before.
    • getNumUniqueReReceived

      public int getNumUniqueReReceived​(U u)
      Description copied from interface: Iteration
      Obtains the total number of different information pieces which have been read by a user in the network during this iteration after they were read in a previous iteration.
      Specified by:
      getNumUniqueReReceived in interface Iteration<U,​I,​P>
      Parameters:
      u - the user.
      Returns:
      the number of different information pieces which have been read by the user after they were read in a previous iteration..
    • getReReceivingUsers

      public java.util.stream.Stream<U> getReReceivingUsers()
      Description copied from interface: Iteration
      Obtains the set of users which have received and read, at least, one piece of information they had read before.
      Specified by:
      getReReceivingUsers in interface Iteration<U,​I,​P>
      Returns:
      the set of users which have received and read, at least, one piece of information they had read before.
    • getReReceivedInformation

      public java.util.stream.Stream<Tuple2oo<I,​java.util.Set<U>>> getReReceivedInformation​(U u)
      Description copied from interface: Iteration
      Obtains the set of information that a given user read in previous iterations, and have been re-read in this one.
      Specified by:
      getReReceivedInformation in interface Iteration<U,​I,​P>
      Parameters:
      u - the user.
      Returns:
      the set of information that the user read in previous iterations, and have been re-read in this one.
    • getNumPropagatingUsers

      public int getNumPropagatingUsers()
      Description copied from interface: Iteration
      Obtains the total number of users which have propagated information pieces.
      Specified by:
      getNumPropagatingUsers in interface Iteration<U,​I,​P>
      Returns:
      the total number of users which have propagated information pieces.
    • getNumPropagated

      public int getNumPropagated()
      Description copied from interface: Iteration
      Obtains the total number of propagated information pieces (it does not take into account how many people received them).
      Specified by:
      getNumPropagated in interface Iteration<U,​I,​P>
      Returns:
      the total number of propagated information pieces (it does not take into account how many people received them).
    • getNumPropagated

      public int getNumPropagated​(U u)
      Description copied from interface: Iteration
      Obtains the total number of information pieces that a given user has propagated during this iteration. It does not take into account how many people received (just how many different pieces there are).
      Specified by:
      getNumPropagated in interface Iteration<U,​I,​P>
      Parameters:
      u - the user
      Returns:
      the total number of information pieces that the user has propagated during this iteration.
    • getPropagatingUsers

      public java.util.stream.Stream<U> getPropagatingUsers()
      Description copied from interface: Iteration
      Obtains the set of users which have propagated, at least, one information piece during this iteration.
      Specified by:
      getPropagatingUsers in interface Iteration<U,​I,​P>
      Returns:
      the set of users which have propagated, at least, one information piece during this iteration.
    • getPropagatedInformation

      public java.util.stream.Stream<I> getPropagatedInformation​(U u)
      Description copied from interface: Iteration
      Obtains the set of information pieces that a given user has propagated during this iteration.
      Specified by:
      getPropagatedInformation in interface Iteration<U,​I,​P>
      Parameters:
      u - the user.
      Returns:
      the set of information pieces that the user has propagated during this iteration.
    • getNumDiscardingUsers

      public int getNumDiscardingUsers()
      Description copied from interface: Iteration
      Obtains the total number of users which have discarded information pieces.
      Specified by:
      getNumDiscardingUsers in interface Iteration<U,​I,​P>
      Returns:
      the total number of users which have discarded information pieces.
    • getNumDiscarded

      public int getNumDiscarded()
      Description copied from interface: Iteration
      Obtains the total number of discarded information pieces.
      Specified by:
      getNumDiscarded in interface Iteration<U,​I,​P>
      Returns:
      the total number of discarded information pieces.
    • getNumDiscarded

      public int getNumDiscarded​(U u)
      Description copied from interface: Iteration
      Obtains the total number of information pieces that a given user has discarded during this iteration.
      Specified by:
      getNumDiscarded in interface Iteration<U,​I,​P>
      Parameters:
      u - the user.
      Returns:
      the total number of information pieces that the user has discarded during this iteration.
    • getDiscardingUsers

      public java.util.stream.Stream<U> getDiscardingUsers()
      Description copied from interface: Iteration
      Obtains the set of users which have discarded, at least, one information piece during this iteration.
      Specified by:
      getDiscardingUsers in interface Iteration<U,​I,​P>
      Returns:
      the set of users which have discarded, at least, one information piece during this iteration.
    • getDiscardedInformation

      public java.util.stream.Stream<I> getDiscardedInformation​(U u)
      Description copied from interface: Iteration
      Obtains the set of information pieces that a given user has discarded during this iteration.
      Specified by:
      getDiscardedInformation in interface Iteration<U,​I,​P>
      Parameters:
      u - the user.
      Returns:
      the set of information pieces that the user has discarded during this iteration.