warehouse.java~3~
来自「《深入浅出设计模式》的完整源代码」· JAVA~3~ 代码 · 共 29 行
JAVA~3~
29 行
package securitysystem;public class Warehouse extends SecurityZone{ /** * This method is called by the notify method so that this * object can have a chance to handle measurements. */ boolean handleNotification(int measurement, Sensor sensor) { return false; } // handleNotification(int, Sensor) void fireAlarm(SecurityZone zone) { if (zone instanceof Area) { // Turn on sprinklers in surrounding areas // Don't call super.fireAlarm because that will turn on the // sprinkler for the whole warehouse. if (getParent() != null) getParent().fireAlarm(zone); return; } // if super.fireAlarm(zone); } // fireAlarm(SecurityZone) public Warehouse(String string) { super(string); } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?