skeletonmain.java.svn-base
来自「這是一個JAVA語言寫的多代理人程式用來模擬飛機起飛或是降落的程式」· SVN-BASE 代码 · 共 88 行
SVN-BASE
88 行
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 + =
减小字号Ctrl + -
显示快捷键?