Boiler.javaAPI DocExample1730Tue Jun 03 23:54:08 BST 1997BeansBook.Simulator


public class Boiler extends TemperatureModifier implements HeatingRequestListener, VetoableChangeListener

Fields Summary
Constructors Summary
public Boiler()

      // a boiler is a temperature modifier that operates at
      // 100 degress celsius
      super(100.0, "BOILER ON", "BOILER OFF",
     , Color.yellow);
Methods Summary
public voidheatingRequest(ServiceRequestEvent evt)

      // set the Running property based on the value returned
      // by the isStart method from the event
public voidvetoableChange(java.beans.PropertyChangeEvent evt)

      // only interested in ComfortTemperature
      if (evt.getPropertyName().equals("ComfortTemperature"))
         // get the proposed temperature
         Double d = (Double)evt.getNewValue();
         // veto a temperature over 100 degrees Celsius
         if (d.doubleValue() > 100.0)
            throw new PropertyVetoException("Invalid Comfort Temperature", evt);