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>allInfoMap containing all the previously received information.private java.util.Map<java.lang.Integer,PropagatedInformation>discardedInfoMap that contains the identifiers of the information discarded by this user.private java.util.Map<java.lang.Integer,PropagatedInformation>ownInfoMap that contains the information created by this user.private java.util.Map<java.lang.Integer,PropagatedInformation>propagatedInfoMap that contains the information propagated by this user.private java.util.Map<java.lang.Integer,PropagatedInformation>receivedInfoMap that contains the previously received information that has not been propagated or discarded.private java.util.Map<java.lang.Integer,PropagatedInformation>seenInfoMap of the newly seen information. -
Constructor Summary
-
Method Summary
Modifier and Type Method Description protected booleanaddAllInformation(PropagatedInformation info)Adds a piece of information to all the received information pieces.protected booleanaddDiscardedInformation(PropagatedInformation info)Adds a piece of information to the discarded information pieces.protected booleanaddOwnInformation(PropagatedInformation info)Adds a piece of information to the own created information pieces.protected booleanaddPropagatedInformation(PropagatedInformation info)Adds a piece of information to the propagated information pieces.protected booleanaddReceivedInformation(PropagatedInformation info)Adds a piece of information to the previously received information pieces.protected booleanaddSeenInformation(PropagatedInformation info)Adds a piece of information to the newly seen information pieces.protected voidclear()Clears all the data for the user.protected voidclearSeenInformation()Clears the seen information.FastUser<U>clone()booleancontainsAllInformation(int info)Checks if an individual piece of all the previous information exists.booleancontainsDiscardedInformation(int info)Gets an individual piece of discarded information.booleancontainsOwnInformation(int info)Gets an individual piece of own created information.booleancontainsPropagatedInformation(int info)Gets an individual piece of propagated information.booleancontainsReceivedInformation(int info)Gets an individual piece of received information.booleancontainsSeenInformation(int info)Gets an individual piece of newly seen information.protected booleandeleteDiscardedInformation(int info)Deletes a piece of discarded information.protected booleandeleteOwnInformation(int info)Deletes a piece of own created information.protected booleandeletePropagatedInformation(int info)Deletes a piece of propagated information.protected booleandeleteReceivedInformation(int info)Deletes a piece of received information.protected booleandeleteSeenInformation(int info)Deletes a piece of newly seen information.booleanequals(java.lang.Object obj)java.util.stream.Stream<PropagatedInformation>getAllInformation()Gets all the information that the user has received during the simulationsprotected PropagatedInformationgetAllInformation(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 PropagatedInformationgetDiscardedInformation(int info)Gets an individual piece of discarded information.java.util.stream.Stream<PropagatedInformation>getOwnInformation()Gets all the information created by this user.protected PropagatedInformationgetOwnInformation(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 PropagatedInformationgetPropagatedInformation(int info)Gets an individual piece of propagated information.java.util.stream.Stream<PropagatedInformation>getReceivedInformation()Gets all the information received by this user.protected PropagatedInformationgetReceivedInformation(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 PropagatedInformationgetSeenInformation(int info)Gets an individual piece of newly seen created informationinthashCode()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:UserStateGets an individual piece of own created information.- Specified by:
containsOwnInformationin classUserState<U>- Parameters:
info- The identifier of the information.- Returns:
- The corresponding piece of information.
-
getOwnInformation
Description copied from class:UserStateGets an individual piece of own created information.- Specified by:
getOwnInformationin classUserState<U>- Parameters:
info- The identifier of the information.- Returns:
- The corresponding piece of information.
-
getOwnInformation
Description copied from class:UserStateGets all the information created by this user. Every tweet contained in this list can be sent.- Specified by:
getOwnInformationin classUserState<U>- Returns:
- The stream.
-
containsReceivedInformation
public boolean containsReceivedInformation(int info)Description copied from class:UserStateGets an individual piece of received information.- Specified by:
containsReceivedInformationin classUserState<U>- Parameters:
info- The iodentifier of the information.- Returns:
- The correspondiing piede of information.
-
getReceivedInformation
Description copied from class:UserStateGets an individual piece of received information.- Specified by:
getReceivedInformationin classUserState<U>- Parameters:
info- The iodentifier of the information.- Returns:
- The correspondiing piede of information.
-
getReceivedInformation
Description copied from class:UserStateGets all the information received by this user. Every tweet contained in this list can be retweeted.- Specified by:
getReceivedInformationin classUserState<U>- Returns:
- A stream with all the information identifiers.
-
containsSeenInformation
public boolean containsSeenInformation(int info)Description copied from class:UserStateGets an individual piece of newly seen information.- Specified by:
containsSeenInformationin classUserState<U>- Parameters:
info- The identifier of the information.- Returns:
- The corresponding piece of information.
-
getSeenInformation
Description copied from class:UserStateGets an individual piece of newly seen created information- Specified by:
getSeenInformationin classUserState<U>- Parameters:
info- The identifier of the information- Returns:
- The corresponding piece of information.
-
getSeenInformation
Description copied from class:UserStateGets all the new information received by this user.- Specified by:
getSeenInformationin classUserState<U>- Returns:
- A stream with all the identifiers.
-
containsPropagatedInformation
public boolean containsPropagatedInformation(int info)Description copied from class:UserStateGets an individual piece of propagated information.- Specified by:
containsPropagatedInformationin classUserState<U>- Parameters:
info- The identifier of the propagated information.- Returns:
- The corresponding piece of information.
-
getPropagatedInformation
Description copied from class:UserStateGets an individual piece of propagated information.- Specified by:
getPropagatedInformationin classUserState<U>- Parameters:
info- The identifier of the propagated information- Returns:
- The corresponding piece of information.
-
getPropagatedInformation
Description copied from class:UserStateGets all the information previously propagated by this user.- Specified by:
getPropagatedInformationin classUserState<U>- Returns:
- A stream with all the information identifiers.
-
containsDiscardedInformation
public boolean containsDiscardedInformation(int info)Description copied from class:UserStateGets an individual piece of discarded information.- Specified by:
containsDiscardedInformationin classUserState<U>- Parameters:
info- The identifier of the discarded information.- Returns:
- The corresponding piece of information.
-
getDiscardedInformation
Description copied from class:UserStateGets an individual piece of discarded information.- Specified by:
getDiscardedInformationin classUserState<U>- Parameters:
info- The identifier of the discarded information.- Returns:
- The corresponding piece of information.
-
getDiscardedInformation
Description copied from class:UserStateGets all the information previously discarded by this user.- Specified by:
getDiscardedInformationin classUserState<U>- Returns:
- A stream with all the discarded information identifiers.
-
addOwnInformation
Description copied from class:UserStateAdds a piece of information to the own created information pieces.- Specified by:
addOwnInformationin classUserState<U>- Parameters:
info- Information to add.- Returns:
- true if everything is OK.
-
addReceivedInformation
Description copied from class:UserStateAdds 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:
addReceivedInformationin classUserState<U>- Parameters:
info- Information to add.- Returns:
- true if everything is OK.
-
addSeenInformation
Description copied from class:UserStateAdds a piece of information to the newly seen information pieces.- Specified by:
addSeenInformationin classUserState<U>- Parameters:
info- Information to add.- Returns:
- true if everything is OK.
-
addDiscardedInformation
Description copied from class:UserStateAdds a piece of information to the discarded information pieces. This information can only be- Specified by:
addDiscardedInformationin classUserState<U>- Parameters:
info- Information to add.- Returns:
- true if everything is OK.
-
addPropagatedInformation
Description copied from class:UserStateAdds a piece of information to the propagated information pieces.- Specified by:
addPropagatedInformationin classUserState<U>- Parameters:
info- Information to add.- Returns:
- true if everything is OK.
-
deleteOwnInformation
protected boolean deleteOwnInformation(int info)Description copied from class:UserStateDeletes a piece of own created information.- Specified by:
deleteOwnInformationin 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:UserStateDeletes a piece of received information.- Specified by:
deleteReceivedInformationin 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:UserStateDeletes a piece of newly seen information.- Specified by:
deleteSeenInformationin 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:UserStateDeletes a piece of propagated information.- Specified by:
deletePropagatedInformationin 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:UserStateDeletes a piece of discarded information.- Specified by:
deleteDiscardedInformationin 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:UserStateAdds a piece of information to all the received information pieces.- Specified by:
addAllInformationin classUserState<U>- Parameters:
info- Information to add.- Returns:
- true if everything is OK.
-
getAllInformation
Description copied from class:UserStateGets an individual piece of the set of all previously received information- Specified by:
getAllInformationin 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:UserStateChecks if an individual piece of all the previous information exists.- Specified by:
containsAllInformationin classUserState<U>- Parameters:
info- The identifier of the piece of information.- Returns:
- true if exists, false if not.
-
getAllInformation
Description copied from class:UserStateGets all the information that the user has received during the simulations- Specified by:
getAllInformationin 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:UserStateClears the seen information.- Specified by:
clearSeenInformationin classUserState<U>
-
clear
protected void clear()Description copied from class:UserStateClears all the data for the user. -
clone
-