public class OptionStub { //+--------+---------------------------------------------------------- //| Fields | //+--------+ /* Name of the user, owner of these options. */ String userName; /* The name in every email sent. For example, if nameInOutgoingMail * is "Cranky", who ever receives the mail from the user will see in the *theader that the mail is from "Cranky". */ String nameInOutgoingMail; /* The width of lines in the display of the message. */ int lineWidth; /* The number of messages displayed in one page. */ int messagesPerPage; /* The option to save sent mails. */ boolean saveOutgoingMail; /* The option to attach the original message in the reply. */ boolean quote; /* The option to have a separator to separate the quoted message. */ boolean separator; /* The option to preview a message. */ boolean previewMessages; /* The user's signature.*/ String signature; /*The option to attach the signature in every outgoing mail.*/ boolean attachSignature; /* The user's passowrd.*/ String password; /*The user's personal information. */ PersonalProfile personalInfo; /* The address book that lists email addresses of different people.*/ Address[] addressBook; /* The preferred filter. */ Filter preferredFilter; //+--------------+--------------------------------------------------------- //| Constructors | //+--------------+ /* Takes the user name as a parameter and returns the user's preference object. */ public OptionStub(String usrName){ userName = usrName; }//Options(String) //+------------+--------------------------------------------------------- //| Extractors | //+------------+ /** * Purpose: Get an option whose value is a number. For now, use integers as * our numbers. * Parameter option name * Pre: The option is initialized. * Post: The option is unchanged. * Return: The value of the given option. * @exception OptionException * If that option is undefined. */ public int getNumericOption(String optionName) throws OptionException { return 10; } /** * Purpose: Get an option whose value is a String. * Parameter option name * Pre: The option is initialized. * Post: The option is unchanged. * Return: The value of the given option. * @exception OptionException * If that option is undefined. */ public String getStringOption(String optionName) throws OptionException { return "stub"; } /** * Purpose: Get an option whose value is some other object. * Parameter: option name * Pre: The option is initialized * Post: The option is unchanged. * Return: The value of the given option. * @exception OptionException * If that option is undefined. */ public Object getOption(String optionName) throws OptionException { return "Stub"; } /** * Purpose: Get a flag: something that can either be on (true) or * off (false). * Parameter: the name of the flag. * Pre: The flag has been initialized. * Post: The flag has not been changed. * Return: the value of the flag, e.g. on or off. * @exception OptionException * if that option is undefined. */ public boolean getFlag(String flagName) throws OptionException { return true; } //+-----------+-------------------------------------------------------- //| Modifiers | //+-----------+ /** * Purpose: Set an option whose value is a string. return the old value. * Parameter: option name and the new value. * Pre: the option is initialized. * Post: The option takes on the new value, no other option value is changed. * Return: The old value of the given option. * @exception OptionException * If that option is undefined */ public void setStringOption(String optionName, String newVal) throws OptionException { } /** * Purpose: Set an option whose value is a number. * For now, we assume that all values are of integer type. * Parameter: option name and the new value. * Pre: the option is initialized. * Post: The option takes on the new value, no other option value is changed. * Return: nothing * @exception OptionException * If that option is undefined */ public void setNumericOption(String optionName, int newValue) throws OptionException { } /** * Purpose: Set a flag, i.e. turn it on or off. * Parameter: the name of the flag and the new value. * Pre: The flag has been initialized. * Post: The flag has been changed. * Return: nothing. * @exception OptionException * if that option is undefined. */ public void setFlag(String flagName, boolean flagValue) throws OptionException { } /** * Purpose: Set an option whose value is an object. * Parameter: option name and the new value. * Pre: the option is initialized. * Post: The option takes on the new value, no other option value is changed. * Return: The old value of the given option. * @exception OptionException * if the option is undefined. */ public void setOption(String optionName, Object newVal) throws OptionException { } //+--------------+-------------------------------------------------- //| Capabilities | //+--------------+ /** * Purpose: convert the contents of the object to a displayable string. * Paramter: none. * Pre: all the fields of the objects are initialized. * Post: no value is changed. * Return: a string containing all values of fields of this object. * Throws no exceptions. */ public String toString(){ return "This is a stub."; } }