⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 skeletonmain.java.svn-base

📁 這是一個JAVA語言寫的多代理人程式用來模擬飛機起飛或是降落的程式
💻 SVN-BASE
字号:
package skeleton;

import agents.*;
import interfaces.*;
import world.*;
import base.*;
import java.util.*;

public class SkeletonMain {
	

	static Airport testAirport  = null;static Airport testAirport1  = null;

	
	public static void test_departing() {
		// Testing the normative scenario for the agents

		testAirport     = new Airport();
		Tower tower     = new Tower();
		Runway runway   = new Runway();
		Gate gate  	    = new Gate(new Taxiway());
		Strip landstrip = new Strip("SWA");
		Strip takestrip = new Strip("UA");
		RealPlane theplane     = new RealPlane("SWA");
		RealPlane thelandplane = new RealPlane("UA");
		

		ClearanceDeliveryAgent clearancedelivery = new ClearanceDeliveryAgent("CD1",tower);
		GroundControllerAgent groundcontroller   = new GroundControllerAgent("GC1",tower);
		LocalControllerAgent localcontroller     = new LocalControllerAgent("LC1",tower);		

		PilotAgent pilot  		                = new PilotAgent(theplane, testAirport, 
				localcontroller, groundcontroller, clearancedelivery, "SWA");

		PilotAgent copilot 						= new PilotAgent(theplane, testAirport,
				localcontroller, groundcontroller, clearancedelivery, "SWA");
		
		theplane.ctrlAssumePilotRole(pilot);
		theplane.ctrlAssumeCoPilotRole(copilot);
		
		System.out.println("// -----  Departing scenario  ------ //");
		clearancedelivery.msgNewDepartingFlight(theplane, "SWA", runway, gate, "LAX", pilot);
		clearancedelivery.msgRequestingClearance("SWA", gate);
		groundcontroller.startThread();
		localcontroller.startThread();
		clearancedelivery.startThread();
		pilot.startThread();
		copilot.startThread();
		theplane.promoteCoPilot(); // code that signifies something wrong with pilot

	}
	public static void test_landing() {
		testAirport     = new Airport();
		Tower tower     = new Tower();
		Runway runway   = new Runway();
		Gate gate  	    = new Gate(new Taxiway());
		Strip landstrip = new Strip("SWA");
		Strip takestrip = new Strip("UA");
		RealPlane theplane     = new RealPlane("SWA");
		RealPlane thelandplane = new RealPlane("UA");
		ClearanceDeliveryAgent clearancedelivery = new ClearanceDeliveryAgent("CD1",tower);
		GroundControllerAgent groundcontroller   = new GroundControllerAgent("GC1",tower);
		LocalControllerAgent localcontroller     = new LocalControllerAgent("LC1",tower);		

		PilotAgent pilot  		                = new PilotAgent(theplane, testAirport1, 
				localcontroller, groundcontroller, clearancedelivery, "SWA");
		
		System.out.println("// -----  Landing scenario  ------ //");
		localcontroller.msgNewArrivingFlight("SWA", runway, gate);
		localcontroller.msgRequestToLand("SWA", "visual", runway);
		groundcontroller.startThread();
		localcontroller.startThread();
		clearancedelivery.startThread();
		pilot.startThread();
		
	}
	
	public static void main(String[] args)
	{
		SkeletonMain main = new SkeletonMain();
		boolean landing = false;
		
		main.test_departing();	
		
	}
	
}

⌨️ 快捷键说明

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