java编程思想第3版原代码分享是java编程思想一本好书,大家多多学习

源代码在线查看: controller.java

软件大小: 403 K
上传用户: huanzhudev
关键词: java 编程 代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				//: c08:controller:Controller.java
				// With Event, the generic framework for control systems.
				// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
				// www.BruceEckel.com. See copyright notice in CopyRight.txt.
				package c08.controller;
				import java.util.*;
				
				public class Controller {
				  // An object from java.util to hold Event objects:
				  private List eventList = new ArrayList();
				  public void addEvent(Event c) { eventList.add(c); }
				  public void run() {
				    while(eventList.size() > 0) {
				      for(int i = 0; i < eventList.size(); i++) {
				        Event e = (Event)eventList.get(i);
				        if(e.ready()) {
				          System.out.println(e);
				          e.action();
				          eventList.remove(i);
				        }
				      }
				    }
				  }
				} ///:~
							

相关资源