Class FastUser<U>
java.lang.Object
es.uam.eps.ir.relison.diffusion.simulation.UserState<U>
es.uam.eps.ir.relison.diffusion.data.FastUser<U>
- Type Parameters:
U
- Type of the users.
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
public class FastUser<U> extends UserState<U> implements java.io.Serializable, java.lang.Cloneable
Fast implementation for users. To improve performance, only information identifiers are
stored for the own information, the propagated information and the discarded
information.
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.Integer,PropagatedInformation>
allInfo
Map containing all the previously received information.private java.util.Map<java.lang.Integer,PropagatedInformation>
discardedInfo
Map that contains the identifiers of the information discarded by this user.private java.util.Map<java.lang.Integer,PropagatedInformation>
ownInfo
Map that contains the information created by this user.private java.util.Map<java.lang.Integer,PropagatedInformation>
propagatedInfo
Map that contains the information propagated by this user.private java.util.Map<java.lang.Integer,PropagatedInformation>
receivedInfo
Map that contains the previously received information that has not been propagated or discarded.private java.util.Map<java.lang.Integer,PropagatedInformation>
seenInfo
Map of the newly seen information. -
Constructor Summary
-
Method Summary
Modifier and Type Method Description protected boolean
addAllInformation(PropagatedInformation info)
Adds a piece of information to all the received information pieces.protected boolean
addDiscardedInformation(PropagatedInformation info)
Adds a piece of information to the discarded information pieces.protected boolean
addOwnInformation(PropagatedInformation info)
Adds a piece of information to the own created information pieces.protected boolean
addPropagatedInformation(PropagatedInformation info)
Adds a piece of information to the propagated information pieces.protected boolean
addReceivedInformation(PropagatedInformation info)
Adds a piece of information to the previously received information pieces.protected boolean
addSeenInformation(PropagatedInformation info)
Adds a piece of information to the newly seen information pieces.protected void
clear()
Clears all the data for the user.protected void
clearSeenInformation()
Clears the seen information.FastUser<U>
clone()
boolean
containsAllInformation(int info)
Checks if an individual piece of all the previous information exists.boolean
containsDiscardedInformation(int info)
Gets an individual piece of discarded information.boolean
containsOwnInformation(int info)
Gets an individual piece of own created information.boolean
containsPropagatedInformation(int info)
Gets an individual piece of propagated information.boolean
containsReceivedInformation(int info)
Gets an individual piece of received information.boolean
containsSeenInformation(int info)
Gets an individual piece of newly seen information.protected boolean
deleteDiscardedInformation(int info)
Deletes a piece of discarded information.protected boolean
deleteOwnInformation(int info)
Deletes a piece of own created information.protected boolean
deletePropagatedInformation(int info)
Deletes a piece of propagated information.protected boolean
deleteReceivedInformation(int info)
Deletes a piece of received information.protected boolean
deleteSeenInformation(int info)
Deletes a piece of newly seen information.boolean
equals(java.lang.Object obj)
java.util.stream.Stream<PropagatedInformation>
getAllInformation()
Gets all the information that the user has received during the simulationsprotected PropagatedInformation
getAllInformation(int info)
Gets an individual piece of the set of all previously received informationjava.util.stream.Stream<PropagatedInformation>
getDiscardedInformation()
Gets all the information previously discarded by this user.protected PropagatedInformation
getDiscardedInformation(int info)
Gets an individual piece of discarded information.java.util.stream.Stream<PropagatedInformation>
getOwnInformation()
Gets all the information created by this user.protected PropagatedInformation
getOwnInformation(int info)
Gets an individual piece of own created information.java.util.stream.Stream<PropagatedInformation>
getPropagatedInformation()
Gets all the information previously propagated by this user.protected PropagatedInformation
getPropagatedInformation(int info)
Gets an individual piece of propagated information.java.util.stream.Stream<PropagatedInformation>
getReceivedInformation()
Gets all the information received by this user.protected PropagatedInformation
getReceivedInformation(int info)
Gets an individual piece of received information.java.util.stream.Stream<PropagatedInformation>
getSeenInformation()
Gets all the new information received by this user.protected PropagatedInformation
getSeenInformation(int info)
Gets an individual piece of newly seen created informationint
hashCode()
Methods inherited from class es.uam.eps.ir.relison.diffusion.simulation.UserState
discardReceivedInformation, getAllInformationIds, getDiscardedInformationIds, getOwnInformationIds, getPropagatedInformationIds, getReceivedInformationIds, getSeenInformationIds, getUserId, resetOwnInformation, updateAll, updateOwnToPropagated, updateReceivedToPropagated, updateSeen, updateSeen, updateSeenToReceived, updateSeenToReceived
-
Field Details
-
ownInfo
Map that contains the information created by this user. -
receivedInfo
Map that contains the previously received information that has not been propagated or discarded. -
propagatedInfo
Map that contains the information propagated by this user. -
discardedInfo
Map that contains the identifiers of the information discarded by this user. -
seenInfo
Map of the newly seen information. -
allInfo
Map containing all the previously received information.
-
-
Constructor Details
-
FastUser
Constructor.- Parameters:
userId
- Identifier of the user.
-
-
Method Details
-
containsOwnInformation
public boolean containsOwnInformation(int info)Description copied from class:UserState
Gets an individual piece of own created information.- Specified by:
containsOwnInformation
in classUserState<U>
- Parameters:
info
- The identifier of the information.- Returns:
- The corresponding piece of information.
-
getOwnInformation
Description copied from class:UserState
Gets an individual piece of own created information.- Specified by:
getOwnInformation
in classUserState<U>
- Parameters:
info
- The identifier of the information.- Returns:
- The corresponding piece of information.
-
getOwnInformation
Description copied from class:UserState
Gets all the information created by this user. Every tweet contained in this list can be sent.- Specified by:
getOwnInformation
in classUserState<U>
- Returns:
- The stream.
-
containsReceivedInformation
public boolean containsReceivedInformation(int info)Description copied from class:UserState
Gets an individual piece of received information.- Specified by:
containsReceivedInformation
in classUserState<U>
- Parameters:
info
- The iodentifier of the information.- Returns:
- The correspondiing piede of information.
-
getReceivedInformation
Description copied from class:UserState
Gets an individual piece of received information.- Specified by:
getReceivedInformation
in classUserState<U>
- Parameters:
info
- The iodentifier of the information.- Returns:
- The correspondiing piede of information.
-
getReceivedInformation
Description copied from class:UserState
Gets all the information received by this user. Every tweet contained in this list can be retweeted.- Specified by:
getReceivedInformation
in classUserState<U>
- Returns:
- A stream with all the information identifiers.
-
containsSeenInformation
public boolean containsSeenInformation(int info)Description copied from class:UserState
Gets an individual piece of newly seen information.- Specified by:
containsSeenInformation
in classUserState<U>
- Parameters:
info
- The identifier of the information.- Returns:
- The corresponding piece of information.
-
getSeenInformation
Description copied from class:UserState
Gets an individual piece of newly seen created information- Specified by:
getSeenInformation
in classUserState<U>
- Parameters:
info
- The identifier of the information- Returns:
- The corresponding piece of information.
-
getSeenInformation
Description copied from class:UserState
Gets all the new information received by this user.- Specified by:
getSeenInformation
in classUserState<U>
- Returns:
- A stream with all the identifiers.
-
containsPropagatedInformation
public boolean containsPropagatedInformation(int info)Description copied from class:UserState
Gets an individual piece of propagated information.- Specified by:
containsPropagatedInformation
in classUserState<U>
- Parameters:
info
- The identifier of the propagated information.- Returns:
- The corresponding piece of information.
-
getPropagatedInformation
Description copied from class:UserState
Gets an individual piece of propagated information.- Specified by:
getPropagatedInformation
in classUserState<U>
- Parameters:
info
- The identifier of the propagated information- Returns:
- The corresponding piece of information.
-
getPropagatedInformation
Description copied from class:UserState
Gets all the information previously propagated by this user.- Specified by:
getPropagatedInformation
in classUserState<U>
- Returns:
- A stream with all the information identifiers.
-
containsDiscardedInformation
public boolean containsDiscardedInformation(int info)Description copied from class:UserState
Gets an individual piece of discarded information.- Specified by:
containsDiscardedInformation
in classUserState<U>
- Parameters:
info
- The identifier of the discarded information.- Returns:
- The corresponding piece of information.
-
getDiscardedInformation
Description copied from class:UserState
Gets an individual piece of discarded information.- Specified by:
getDiscardedInformation
in classUserState<U>
- Parameters:
info
- The identifier of the discarded information.- Returns:
- The corresponding piece of information.
-
getDiscardedInformation
Description copied from class:UserState
Gets all the information previously discarded by this user.- Specified by:
getDiscardedInformation
in classUserState<U>
- Returns:
- A stream with all the discarded information identifiers.
-
addOwnInformation
Description copied from class:UserState
Adds a piece of information to the own created information pieces.- Specified by:
addOwnInformation
in classUserState<U>
- Parameters:
info
- Information to add.- Returns:
- true if everything is OK.
-
addReceivedInformation
Description copied from class:UserState
Adds a piece of information to the previously received information pieces. This information can only be added if it was previously on the newly received information data. This method also deletes the data from that list.- Specified by:
addReceivedInformation
in classUserState<U>
- Parameters:
info
- Information to add.- Returns:
- true if everything is OK.
-
addSeenInformation
Description copied from class:UserState
Adds a piece of information to the newly seen information pieces.- Specified by:
addSeenInformation
in classUserState<U>
- Parameters:
info
- Information to add.- Returns:
- true if everything is OK.
-
addDiscardedInformation
Description copied from class:UserState
Adds a piece of information to the discarded information pieces. This information can only be- Specified by:
addDiscardedInformation
in classUserState<U>
- Parameters:
info
- Information to add.- Returns:
- true if everything is OK.
-
addPropagatedInformation
Description copied from class:UserState
Adds a piece of information to the propagated information pieces.- Specified by:
addPropagatedInformation
in classUserState<U>
- Parameters:
info
- Information to add.- Returns:
- true if everything is OK.
-
deleteOwnInformation
protected boolean deleteOwnInformation(int info)Description copied from class:UserState
Deletes a piece of own created information.- Specified by:
deleteOwnInformation
in classUserState<U>
- Parameters:
info
- The identifier of the own created information.- Returns:
- true if the information is deleted, false if not.
-
deleteReceivedInformation
protected boolean deleteReceivedInformation(int info)Description copied from class:UserState
Deletes a piece of received information.- Specified by:
deleteReceivedInformation
in classUserState<U>
- Parameters:
info
- The identifier of the received information- Returns:
- true if the information is deleted, false if not.
-
deleteSeenInformation
protected boolean deleteSeenInformation(int info)Description copied from class:UserState
Deletes a piece of newly seen information.- Specified by:
deleteSeenInformation
in classUserState<U>
- Parameters:
info
- The identifier of the newly received information.- Returns:
- true if the information is deleted, false if not.
-
deletePropagatedInformation
protected boolean deletePropagatedInformation(int info)Description copied from class:UserState
Deletes a piece of propagated information.- Specified by:
deletePropagatedInformation
in classUserState<U>
- Parameters:
info
- The identifier of the propagter information.- Returns:
- true if the information is deleted, false if not.
-
deleteDiscardedInformation
protected boolean deleteDiscardedInformation(int info)Description copied from class:UserState
Deletes a piece of discarded information.- Specified by:
deleteDiscardedInformation
in classUserState<U>
- Parameters:
info
- The identifier of the discarded information.- Returns:
- true if the information is deleted, false if not.
-
addAllInformation
Description copied from class:UserState
Adds a piece of information to all the received information pieces.- Specified by:
addAllInformation
in classUserState<U>
- Parameters:
info
- Information to add.- Returns:
- true if everything is OK.
-
getAllInformation
Description copied from class:UserState
Gets an individual piece of the set of all previously received information- Specified by:
getAllInformation
in classUserState<U>
- Parameters:
info
- The identifier of the discarded information.- Returns:
- The corresponding piece of information.
-
containsAllInformation
public boolean containsAllInformation(int info)Description copied from class:UserState
Checks if an individual piece of all the previous information exists.- Specified by:
containsAllInformation
in classUserState<U>
- Parameters:
info
- The identifier of the piece of information.- Returns:
- true if exists, false if not.
-
getAllInformation
Description copied from class:UserState
Gets all the information that the user has received during the simulations- Specified by:
getAllInformation
in classUserState<U>
- Returns:
- A stream with all the information.
-
equals
public boolean equals(java.lang.Object obj) -
hashCode
public int hashCode() -
clearSeenInformation
protected void clearSeenInformation()Description copied from class:UserState
Clears the seen information.- Specified by:
clearSeenInformation
in classUserState<U>
-
clear
protected void clear()Description copied from class:UserState
Clears all the data for the user. -
clone
-