Class CountSightMechanism<U extends java.io.Serializable,I extends java.io.Serializable,P>
java.lang.Object
es.uam.eps.ir.relison.diffusion.sight.CountSightMechanism<U,I,P>
- Type Parameters:
U- type of the users.I- type of the information pieces.P- type of the parameters.
- All Implemented Interfaces:
SightMechanism<U,I,P>
public class CountSightMechanism<U extends java.io.Serializable,I extends java.io.Serializable,P> extends java.lang.Object implements SightMechanism<U,I,P>
The user sees (at most) a fixed number of (different) information pieces each iteration. The pieces are chosen
randomly among all the received ones. If two instances of the same piece are received and one of them is seen,
we assume that both have been.
-
Field Summary
Fields Modifier and Type Field Description private intnumSightNumber of pieces of information that a user sees in a single iteration. -
Constructor Summary
Constructors Constructor Description CountSightMechanism(int numSight)Constructor. -
Method Summary
Modifier and Type Method Description voidresetSelections(Data<U,I,P> data)For each user, this method preconfigures the sight mechanism (for example, selecting a fixed set of users whom each user pays attention to).java.util.List<PropagatedInformation>seesInformation(UserState<U> user, Data<U,I,P> data, java.util.List<PropagatedInformation> prop)Given a list of propagated information, it identifies which pieces the user has seen.
-
Field Details
-
numSight
private final int numSightNumber of pieces of information that a user sees in a single iteration.
-
-
Constructor Details
-
CountSightMechanism
public CountSightMechanism(int numSight)Constructor.- Parameters:
numSight- number of pieces of information that a user sees (at most) in a single iteration.
-
-
Method Details
-
seesInformation
public java.util.List<PropagatedInformation> seesInformation(UserState<U> user, Data<U,I,P> data, java.util.List<PropagatedInformation> prop)Description copied from interface:SightMechanismGiven a list of propagated information, it identifies which pieces the user has seen.- Specified by:
seesInformationin interfaceSightMechanism<U extends java.io.Serializable,I extends java.io.Serializable,P>- Parameters:
user- the current state of the user.data- the simulation data.prop- the list of propagated information.- Returns:
- a list containing all the information that the user pays attention to from the list of received pieces.
-
resetSelections
Description copied from interface:SightMechanismFor each user, this method preconfigures the sight mechanism (for example, selecting a fixed set of users whom each user pays attention to).- Specified by:
resetSelectionsin interfaceSightMechanism<U extends java.io.Serializable,I extends java.io.Serializable,P>- Parameters:
data- the simulation data.
-