Class UserState<U>
java.lang.Object
es.uam.eps.ir.relison.diffusion.simulation.UserState<U>
- Type Parameters:
U
- type of the user identifier.
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
FastUser
public abstract class UserState<U>
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
Abstract representation for the users.
- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description protected abstract boolean
addAllInformation(PropagatedInformation info)
Adds a piece of information to all the received information pieces.protected abstract boolean
addDiscardedInformation(PropagatedInformation info)
Adds a piece of information to the discarded information pieces.protected abstract boolean
addOwnInformation(PropagatedInformation info)
Adds a piece of information to the own created information pieces.protected abstract boolean
addPropagatedInformation(PropagatedInformation info)
Adds a piece of information to the propagated information pieces.protected abstract boolean
addReceivedInformation(PropagatedInformation info)
Adds a piece of information to the previously received information pieces.protected abstract boolean
addSeenInformation(PropagatedInformation info)
Adds a piece of information to the newly seen information pieces.protected abstract void
clear()
Clears all the data for the user.protected abstract void
clearSeenInformation()
Clears the seen information.UserState<U>
clone()
abstract boolean
containsAllInformation(int info)
Checks if an individual piece of all the previous information exists.abstract boolean
containsDiscardedInformation(int info)
Gets an individual piece of discarded information.abstract boolean
containsOwnInformation(int info)
Gets an individual piece of own created information.abstract boolean
containsPropagatedInformation(int info)
Gets an individual piece of propagated information.abstract boolean
containsReceivedInformation(int info)
Gets an individual piece of received information.abstract boolean
containsSeenInformation(int info)
Gets an individual piece of newly seen information.protected abstract boolean
deleteDiscardedInformation(int info)
Deletes a piece of discarded information.protected abstract boolean
deleteOwnInformation(int info)
Deletes a piece of own created information.protected abstract boolean
deletePropagatedInformation(int info)
Deletes a piece of propagated information.protected abstract boolean
deleteReceivedInformation(int info)
Deletes a piece of received information.protected abstract boolean
deleteSeenInformation(int info)
Deletes a piece of newly seen information.void
discardReceivedInformation(java.util.stream.Stream<java.lang.Integer> information)
Discards part of the received information.boolean
equals(java.lang.Object object)
abstract java.util.stream.Stream<PropagatedInformation>
getAllInformation()
Gets all the information that the user has received during the simulationsprotected abstract PropagatedInformation
getAllInformation(int info)
Gets an individual piece of the set of all previously received informationjava.util.stream.Stream<java.lang.Integer>
getAllInformationIds()
Gets all the information that the user has received along timeabstract java.util.stream.Stream<PropagatedInformation>
getDiscardedInformation()
Gets all the information previously discarded by this user.protected abstract PropagatedInformation
getDiscardedInformation(int info)
Gets an individual piece of discarded information.java.util.stream.Stream<java.lang.Integer>
getDiscardedInformationIds()
Gets all the information previously discarded by this user.abstract java.util.stream.Stream<PropagatedInformation>
getOwnInformation()
Gets all the information created by this user.protected abstract PropagatedInformation
getOwnInformation(int info)
Gets an individual piece of own created information.java.util.stream.Stream<java.lang.Integer>
getOwnInformationIds()
Gets all the identifiers of the information created by this user.abstract java.util.stream.Stream<PropagatedInformation>
getPropagatedInformation()
Gets all the information previously propagated by this user.protected abstract PropagatedInformation
getPropagatedInformation(int info)
Gets an individual piece of propagated information.java.util.stream.Stream<java.lang.Integer>
getPropagatedInformationIds()
Gets all the information previously propagated by this user.abstract java.util.stream.Stream<PropagatedInformation>
getReceivedInformation()
Gets all the information received by this user.protected abstract PropagatedInformation
getReceivedInformation(int info)
Gets an individual piece of received information.java.util.stream.Stream<java.lang.Integer>
getReceivedInformationIds()
Gets all the identifiers of the information received by this user.abstract java.util.stream.Stream<PropagatedInformation>
getSeenInformation()
Gets all the new information received by this user.protected abstract PropagatedInformation
getSeenInformation(int info)
Gets an individual piece of newly seen created informationjava.util.stream.Stream<java.lang.Integer>
getSeenInformationIds()
Gets all the new information seen by this user.U
getUserId()
Obtains the identifier of the user.int
hashCode()
void
resetOwnInformation(java.util.stream.Stream<PropagatedInformation> information)
Resets the list of own information.void
updateAll(PropagatedInformation info)
Adds and updates new information pieces to the list of all previously contained information.void
updateOwnToPropagated(java.util.stream.Stream<java.lang.Integer> toPropagate)
Moves some own created information to propagated information.void
updateReceivedToPropagated(java.util.stream.Stream<java.lang.Integer> toPropagate)
Moves some received information to propagated information.void
updateSeen(PropagatedInformation info)
Adds and updates new information pieces to the new list.void
updateSeen(java.util.stream.Stream<PropagatedInformation> information)
Adds and updates new information pieces to the new list.void
updateSeenToReceived(int info, UpdateMechanism update)
Updates an individual seen piece of information to received.void
updateSeenToReceived(UpdateMechanism update)
Moves the valid elements from the new set of pieces of information to the received one.
-
Field Details
-
userId
Identifier of the user.
-
-
Constructor Details
-
UserState
Constructor.- Parameters:
userId
- identifier of the user.
-
-
Method Details
-
getUserId
Obtains the identifier of the user.- Returns:
- the identifier.
-
addOwnInformation
Adds a piece of information to the own created information pieces.- Parameters:
info
- Information to add.- Returns:
- true if everything is OK.
-
addReceivedInformation
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.- Parameters:
info
- Information to add.- Returns:
- true if everything is OK.
-
addSeenInformation
Adds a piece of information to the newly seen information pieces.- Parameters:
info
- Information to add.- Returns:
- true if everything is OK.
-
addDiscardedInformation
Adds a piece of information to the discarded information pieces. This information can only be- Parameters:
info
- Information to add.- Returns:
- true if everything is OK.
-
addPropagatedInformation
Adds a piece of information to the propagated information pieces.- Parameters:
info
- Information to add.- Returns:
- true if everything is OK.
-
addAllInformation
Adds a piece of information to all the received information pieces.- Parameters:
info
- Information to add.- Returns:
- true if everything is OK.
-
getOwnInformation
Gets an individual piece of own created information.- Parameters:
info
- The identifier of the information.- Returns:
- The corresponding piece of information.
-
getReceivedInformation
Gets an individual piece of received information.- Parameters:
info
- The iodentifier of the information.- Returns:
- The correspondiing piede of information.
-
getSeenInformation
Gets an individual piece of newly seen created information- Parameters:
info
- The identifier of the information- Returns:
- The corresponding piece of information.
-
getPropagatedInformation
Gets an individual piece of propagated information.- Parameters:
info
- The identifier of the propagated information- Returns:
- The corresponding piece of information.
-
getDiscardedInformation
Gets an individual piece of discarded information.- Parameters:
info
- The identifier of the discarded information.- Returns:
- The corresponding piece of information.
-
getAllInformation
Gets an individual piece of the set of all previously received information- Parameters:
info
- The identifier of the discarded information.- Returns:
- The corresponding piece of information.
-
containsOwnInformation
public abstract boolean containsOwnInformation(int info)Gets an individual piece of own created information.- Parameters:
info
- The identifier of the information.- Returns:
- The corresponding piece of information.
-
containsReceivedInformation
public abstract boolean containsReceivedInformation(int info)Gets an individual piece of received information.- Parameters:
info
- The iodentifier of the information.- Returns:
- The correspondiing piede of information.
-
containsSeenInformation
public abstract boolean containsSeenInformation(int info)Gets an individual piece of newly seen information.- Parameters:
info
- The identifier of the information.- Returns:
- The corresponding piece of information.
-
containsPropagatedInformation
public abstract boolean containsPropagatedInformation(int info)Gets an individual piece of propagated information.- Parameters:
info
- The identifier of the propagated information.- Returns:
- The corresponding piece of information.
-
containsDiscardedInformation
public abstract boolean containsDiscardedInformation(int info)Gets an individual piece of discarded information.- Parameters:
info
- The identifier of the discarded information.- Returns:
- The corresponding piece of information.
-
containsAllInformation
public abstract boolean containsAllInformation(int info)Checks if an individual piece of all the previous information exists.- Parameters:
info
- The identifier of the piece of information.- Returns:
- true if exists, false if not.
-
deleteOwnInformation
protected abstract boolean deleteOwnInformation(int info)Deletes a piece of own created information.- Parameters:
info
- The identifier of the own created information.- Returns:
- true if the information is deleted, false if not.
-
deleteReceivedInformation
protected abstract boolean deleteReceivedInformation(int info)Deletes a piece of received information.- Parameters:
info
- The identifier of the received information- Returns:
- true if the information is deleted, false if not.
-
deleteSeenInformation
protected abstract boolean deleteSeenInformation(int info)Deletes a piece of newly seen information.- Parameters:
info
- The identifier of the newly received information.- Returns:
- true if the information is deleted, false if not.
-
deletePropagatedInformation
protected abstract boolean deletePropagatedInformation(int info)Deletes a piece of propagated information.- Parameters:
info
- The identifier of the propagter information.- Returns:
- true if the information is deleted, false if not.
-
deleteDiscardedInformation
protected abstract boolean deleteDiscardedInformation(int info)Deletes a piece of discarded information.- Parameters:
info
- The identifier of the discarded information.- Returns:
- true if the information is deleted, false if not.
-
resetOwnInformation
Resets the list of own information.- Parameters:
information
- The new own information.
-
updateSeenToReceived
Moves the valid elements from the new set of pieces of information to the received one.- Parameters:
update
- The update mechanism.
-
updateSeenToReceived
Updates an individual seen piece of information to received.- Parameters:
info
- the information piece.update
- the update mechanism.
-
updateReceivedToPropagated
public void updateReceivedToPropagated(java.util.stream.Stream<java.lang.Integer> toPropagate)Moves some received information to propagated information.- Parameters:
toPropagate
- Information to propagate.
-
updateOwnToPropagated
public void updateOwnToPropagated(java.util.stream.Stream<java.lang.Integer> toPropagate)Moves some own created information to propagated information.- Parameters:
toPropagate
- Information to propagate.
-
updateSeen
Adds and updates new information pieces to the new list.- Parameters:
information
- A stream with all the information pieces to add.
-
discardReceivedInformation
public void discardReceivedInformation(java.util.stream.Stream<java.lang.Integer> information)Discards part of the received information.- Parameters:
information
- the information to discard.
-
updateSeen
Adds and updates new information pieces to the new list. If it is own information or already propagated information, it is not added.- Parameters:
info
- An information piece to add.
-
updateAll
Adds and updates new information pieces to the list of all previously contained information.- Parameters:
info
- An information piece to add.
-
getOwnInformationIds
public java.util.stream.Stream<java.lang.Integer> getOwnInformationIds()Gets all the identifiers of the information created by this user. Every information contained in this list can be sent.- Returns:
- The stream.
-
getReceivedInformationIds
public java.util.stream.Stream<java.lang.Integer> getReceivedInformationIds()Gets all the identifiers of the information received by this user. Every information contained in this list can be sent.- Returns:
- The stream.
-
getPropagatedInformationIds
public java.util.stream.Stream<java.lang.Integer> getPropagatedInformationIds()Gets all the information previously propagated by this user.- Returns:
- A stream with all the information identifiers.
-
getDiscardedInformationIds
public java.util.stream.Stream<java.lang.Integer> getDiscardedInformationIds()Gets all the information previously discarded by this user.- Returns:
- A stream with all the discarded information identifiers.
-
getSeenInformationIds
public java.util.stream.Stream<java.lang.Integer> getSeenInformationIds()Gets all the new information seen by this user.- Returns:
- A stream with all the identifiers.
-
getAllInformationIds
public java.util.stream.Stream<java.lang.Integer> getAllInformationIds()Gets all the information that the user has received along time- Returns:
- A stream with all the identifiers.
-
getOwnInformation
Gets all the information created by this user. Every tweet contained in this list can be sent.- Returns:
- The stream.
-
getReceivedInformation
Gets all the information received by this user. Every tweet contained in this list can be retweeted.- Returns:
- A stream with all the information identifiers.
-
getPropagatedInformation
Gets all the information previously propagated by this user.- Returns:
- A stream with all the information identifiers.
-
getDiscardedInformation
Gets all the information previously discarded by this user.- Returns:
- A stream with all the discarded information identifiers.
-
getSeenInformation
Gets all the new information received by this user.- Returns:
- A stream with all the identifiers.
-
getAllInformation
Gets all the information that the user has received during the simulations- Returns:
- A stream with all the information.
-
equals
public boolean equals(java.lang.Object object)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
clear
protected abstract void clear()Clears all the data for the user. -
clearSeenInformation
protected abstract void clearSeenInformation()Clears the seen information. -
clone
- Overrides:
clone
in classjava.lang.Object
- Throws:
java.lang.CloneNotSupportedException
-