eventhandler.java

来自「sea是一个基于seda模式的实现。这个设计模式将系统分为很多stage。每个s」· Java 代码 · 共 56 行

JAVA
56
字号
/* * Copyright (c) 2003, The Regents of the University of California, through * Lawrence Berkeley National Laboratory (subject to receipt of any required * approvals from the U.S. Dept. of Energy). All rights reserved. */package gov.lbl.dsd.sea;/** * The abstract base class of all asynchronous event handlers. *  * @author whoschek@lbl.gov * @author $Author: gegles $ * @version $Revision: 1.9 $, $Date: 2004/09/16 16:57:15 $ */public abstract class EventHandler {		protected Stage stage = null; // the stage associated with this event handler	protected EventHandler() {} // make constructor invisible in javadoc	/** 	 * Sets the stage associated with this event handler. 	 */	protected void setStage(Stage stage) {		if (this.stage != null && this.stage != stage) 				throw new IllegalArgumentException("Can't change immutable stage");				this.stage = stage;	}	/** 	 * Returns the stage associated with this event handler. 	 */	protected Stage getStage() {		return this.stage;	}	/**	 * Main entry point; called when an event handler should handle the given event.	 */ 	public abstract void handle(Object event);	/**	 * Called when the event handler's stage is started. This method should perform	 * any initialization operations as required by the application. 	 * The default implementation does nothing.	 */	public void onStart() {}		/**	 * Called when the event handler's stage is stopped.	 * The default implementation does nothing.	 */	public void onStop() {}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?