package AWTBPEvents; import java.awt.*; /** * This class encapsulates all the information for * when the blood pressure changes * * @author Stuart Hansen * @version February 2009 */ public class BloodPressureEvent extends AWTEvent implements ActiveEvent { // We use these constants to sort out what type of Blood Pressure // event occurred public static final int SYSTOLIC_EVENT = 0; public static final int DIASTOLIC_EVENT = 1; public static final int WARNING_EVENT = 2; private int value; // the new value // This is the only constructor. public BloodPressureEvent (Object source, int type, int newValue) { super(source, type); this.value = newValue; } // returns the value public int getValue() { return value; } // Handle the event by dispatching it to the source. public void dispatch () { BloodPressureEvent event = (BloodPressureEvent) this; Patient pat = (Patient)getSource(); pat.handleBPEvent(event); } }