if( args.length == 0 )
{ System.out.println( "You must supply a parameter on the command line\n" +
"which is the name of a suitable data file.\n" +
"There are a number of files present in the gui2000 directory:\n\n" +
"\tDataFile1.dat\tDataFile2.dat\tDataFile3.dat\n\n" +
"Run the program with, for example:\n\n" +
"\tjava ATCDemo DataFile1.dat\n\n" +
"For the more curious among you, look at the code for\n" +
"gui2000/AircraftFactory.java which defines how the files are created.\n" );
return;
}
AirSpace a = new AirSpace( "gui2000" + File.separator + args[0] );
ATCDemo t = new ATCDemo();
a.getRadar().addObserver( new RadarDisplay() );
a.getRadar().addObserver( t );
a.getRadio().addObserver( t );
a.startSimulation();
Thread.sleep( 5000 ); // Wait 5 sec
// Send some radio messages
a.getRadio().broadcast( "1234", "CLIMB 150" );
// The next one is incorrect (lower case command)
a.getRadio().broadcast( "1234", "left 60" );
a.getRadio().broadcast( "1234", "LEFT 60" );
Thread.sleep( 5000 );
a.getRadio().broadcast( "4567", "CLIMB 500" );
a.getRadio().broadcast( "4567", "DESCEND 0" );
a.getRadio().broadcast( "4567", "DESCEND 300" );