|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.harvard.deas.hyperenc.gui.MessageStorage
edu.harvard.deas.hyperenc.gui.BasicMessageStorage
public class BasicMessageStorage
Stores collections of GuiMessages. Supports retrieval of all GuiMessages from a particular sender. This implementation is backed by the Java Collections API. It is not backed by any persistent medium, and so the contained messages will be lost when the VM terminates unless the application explicitly writes the contained messages to disk.
All storage in this MessageStorage is done by reference; the returned GuiMessage is the same object reference as the one that was stored.
Thread safety: This implementation is unconditionally thread-safe.
Constructor Summary | |
---|---|
BasicMessageStorage()
Constructs a new, empty BasicMessageStorage. |
Method Summary | |
---|---|
void |
addMessage(GuiMessage msg)
Put message in storage. |
GuiMessage |
getMessage(int id)
Get message from this storage, given its ID. |
Collection<GuiMessage> |
getMessagesBySender(Contact contact)
Get all stored messages sent from a particular contact. |
GuiMessage |
removeMessage(int id)
Remove a message from storage. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BasicMessageStorage()
Method Detail |
---|
public void addMessage(GuiMessage msg)
MessageStorage
addMessage
in class MessageStorage
msg
- Message to be stored.public GuiMessage getMessage(int id)
MessageStorage
getID
method of GuiMessage.
getMessage
in class MessageStorage
id
- ID of desired message.
null
if
there is no such message stored.public Collection<GuiMessage> getMessagesBySender(Contact contact)
MessageStorage
getMessagesBySender
in class MessageStorage
contact
- contact of desired sender
public GuiMessage removeMessage(int id)
MessageStorage
removeMessage
in class MessageStorage
id
- ID of message to be removed.
null
if there is no
such message stored.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |