public class Mailbox extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
greeting |
private MessageQueue |
keptMessages |
private MessageQueue |
newMessages |
private java.lang.String |
passcode |
Constructor and Description |
---|
Mailbox(java.lang.String aPasscode,
java.lang.String aGreeting)
Create Mailbox object.
|
Modifier and Type | Method and Description |
---|---|
void |
addMessage(Message aMessage)
Add a message to the mailbox.
|
boolean |
checkPasscode(java.lang.String aPasscode)
Check if the entered supplied is correct.
|
(package private) Message |
getCurrentMessage()
Get the current message.
|
(package private) java.lang.String |
getGreeting()
Get the mailbox's greeting.
|
Message |
removeCurrentMessage()
Remove the current message from the mailbox.
|
void |
saveCurrentMessage()
Save the current message
|
void |
setGreeting(java.lang.String newGreeting)
Change mailbox's greeting.
|
void |
setPasscode(java.lang.String newPasscode)
Change mailbox's passcode.
|
private MessageQueue newMessages
private MessageQueue keptMessages
private java.lang.String greeting
private java.lang.String passcode
public Mailbox(java.lang.String aPasscode, java.lang.String aGreeting)
aPasscode
- passcode numberaGreeting
- greeting stringpublic boolean checkPasscode(java.lang.String aPasscode)
aPasscode
- a passcode to checkpublic void addMessage(Message aMessage)
aMessage
- the message to be addedMessage getCurrentMessage()
public Message removeCurrentMessage()
public void saveCurrentMessage()
public void setGreeting(java.lang.String newGreeting)
newGreeting
- the new greeting stringpublic void setPasscode(java.lang.String newPasscode)
newPasscode
- the new passcodejava.lang.String getGreeting()