java.lang.ObjectMailServer
public class MailServer
A simple model of a mail server. The server is able to receive mail items for storage, and deliver them to clients on demand.
Constructor Summary | |
---|---|
MailServer()
Construct a mail server. |
Method Summary | |
---|---|
MailItem |
getNextMailItem(java.lang.String who)
Return the next mail item for a user or null if there are none. |
int |
howManyMailItems(java.lang.String who)
Return how many mail items are waiting for a user. |
void |
post(MailItem item)
Add the given mail item to the message list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MailServer()
Method Detail |
---|
public MailItem getNextMailItem(java.lang.String who)
who
- The user requesting their next item.
public int howManyMailItems(java.lang.String who)
who
- The user to check for.
public void post(MailItem item)
item
- The mail item to be stored on the server.