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 piecesprivate int
numDiscardingUsers
Number of users which have discarded, at least, one information piece.private int
numPropagated
Number of propagated information piecesprivate int
numPropagatingUsers
Number of users which have propagated, at least, one information pieceprivate 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 userprivate 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 iterationboolean
addPropagatingUser(U u, java.util.List<I> propagatedPieces)
Adds the propagated pieces of a single user to the iterationboolean
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 iterationjava.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 iterationNumberNumber of the current iteration. -
seenPieces
The set of information pieces observed by each user (and their creators). -
rereceivedPieces
The set of re-received information pieces observed by each user (and their creators). -
propagatedPieces
The set of propagated pieces by each user. -
discardedPieces
The set of discarded information pieces observed by each user. -
numUniqueSeen
private int numUniqueSeenSum of the number of different newly observed pieces by each user -
numSeen
private int numSeenTotal newly observed pieces for the whole set of users. -
numUniqueReReceived
private int numUniqueReReceivedSum of the number of unique re-read information pieces of each user. -
numReReceived
private int numReReceivedTotal re-read information pieces for the whole set of users. -
numPropagated
private int numPropagatedNumber of propagated information pieces -
numDiscarded
private int numDiscardedNumber of discarded information pieces -
numReceivingUsers
private int numReceivingUsersNumber of users which have read, at least, a new information piece. -
numReReceivingUsers
private int numReReceivingUsersNumber of users which have read, at least, one information piece which they had read in a previous iteration. -
numPropagatingUsers
private int numPropagatingUsersNumber of users which have propagated, at least, one information piece -
numDiscardingUsers
private int numDiscardingUsersNumber 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
Description copied from interface:Iteration
Adds the received pieces of a single user to the iteration.- Specified by:
addReceivingUser
in interfaceIteration<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
Description copied from interface:Iteration
Adds the re-received pieces of a single user discarded pieces to the iteration- Specified by:
addReReceivingUser
in interfaceIteration<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
Description copied from interface:Iteration
Adds the propagated pieces of a single user to the iteration- Specified by:
addPropagatingUser
in interfaceIteration<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
Description copied from interface:Iteration
Adds the discarded pieces of a single user to the iteration- Specified by:
addDiscardingUser
in interfaceIteration<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 interfaceIteration<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 interfaceIteration<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 interfaceIteration<U,I,P>
- Returns:
- the number of newly seen information pieces.
-
getNumSeen
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 interfaceIteration<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 interfaceIteration<U,I,P>
- Returns:
- the number of newly seen information pieces (without frequency).
-
getNumUniqueSeen
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 interfaceIteration<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
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 interfaceIteration<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
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 interfaceIteration<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 interfaceIteration<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 interfaceIteration<U,I,P>
- Returns:
- the number of seen information pieces which had been read before.
-
getNumReReceived
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 interfaceIteration<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 interfaceIteration<U,I,P>
- Returns:
- the number of seen information pieces (without frequency) which had been read before.
-
getNumUniqueReReceived
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 interfaceIteration<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
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 interfaceIteration<U,I,P>
- Returns:
- the set of users which have received and read, at least, one piece of information they had read before.
-
getReReceivedInformation
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 interfaceIteration<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 interfaceIteration<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 interfaceIteration<U,I,P>
- Returns:
- the total number of propagated information pieces (it does not take into account how many people received them).
-
getNumPropagated
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 interfaceIteration<U,I,P>
- Parameters:
u
- the user- Returns:
- the total number of information pieces that the user has propagated during this iteration.
-
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 interfaceIteration<U,I,P>
- Returns:
- the set of users which have propagated, at least, one information piece during this iteration.
-
getPropagatedInformation
Description copied from interface:Iteration
Obtains the set of information pieces that a given user has propagated during this iteration.- Specified by:
getPropagatedInformation
in interfaceIteration<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 interfaceIteration<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 interfaceIteration<U,I,P>
- Returns:
- the total number of discarded information pieces.
-
getNumDiscarded
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 interfaceIteration<U,I,P>
- Parameters:
u
- the user.- Returns:
- the total number of information pieces that the user has discarded during this iteration.
-
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 interfaceIteration<U,I,P>
- Returns:
- the set of users which have discarded, at least, one information piece during this iteration.
-
getDiscardedInformation
Description copied from interface:Iteration
Obtains the set of information pieces that a given user has discarded during this iteration.- Specified by:
getDiscardedInformation
in interfaceIteration<U,I,P>
- Parameters:
u
- the user.- Returns:
- the set of information pieces that the user has discarded during this iteration.
-