/**
 * A message containing emergency information
 *
 * This version implements the Prioritized interface
 * 
 * @version 2.0
 * @author  David Bernstein, James Madison University
 */
public class EmergencyMessage implements Prioritized
{
    private int        priority;   // Note: These attributes are private
    private String     message;    //       not protected.



    /**
     * Construct a new EmergencyMessage
     *
     * @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
     * (part of being 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;
    }
}






