/**
 * A message containing emergency information.
 *
 * This version implements the Prioritized interface.
 * 
 * @author  Prof. David Bernstein, James Madison University
 * @version 2.0
 */
public class EmergencyMessage implements Prioritized
{
    private int        priority;   // Note: These attributes are private
    private String     message;    //       not protected.


    /**
     * Explicit Value Constructor.
     *
     * @param message   The text of the mesage
     */
    public EmergencyMessage(String message)
    {
	this.message = message;
    }

    /**
     * Return the text of this message.
     *
     * @return   The text of the message
     */
    public String getMessage()
    {
	return message;
    }

    /**
     * Return the priority of this message (required by Prioritized).
     *
     * @return   The priority of the message
     */
    public int getPriority()
    {
	return priority;
    }

    /**
     * Set the priority of this message.
     *
     * @param priority   The priority of the message
     */
    public void setPriority(int priority)
    {
	if      (priority <  0) this.priority =  0;
        else if (priority > 10) this.priority = 10;
        else                    this.priority = priority;
    }
}






