Class MailServer

java.lang.Object
  extended by MailServer

public class MailServer
extends java.lang.Object

A simple model of a mail server. The server is able to receive mail items for storage, and deliver them to clients on demand.

Version:
2005.07.06
Author:
David J. Barnes and Michael Kolling

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

MailServer

public MailServer()
Construct a mail server.

Method Detail

getNextMailItem

public MailItem getNextMailItem(java.lang.String who)
Return the next mail item for a user or null if there are none.

Parameters:
who - The user requesting their next item.
Returns:
The user's next item.

howManyMailItems

public int howManyMailItems(java.lang.String who)
Return how many mail items are waiting for a user.

Parameters:
who - The user to check for.
Returns:
How many items are waiting.

post

public void post(MailItem item)
Add the given mail item to the message list.

Parameters:
item - The mail item to be stored on the server.