Create a new airspace populated with aircraft. FileInputStream fis = null;
ObjectInputStream ois = null;
try
{ fis = new FileInputStream( filename );
ois = new ObjectInputStream( fis );
aircraft = (Vector)(ois.readObject());
}
catch( FileNotFoundException fnf )
{ fnf.printStackTrace();
System.out.println( "\n\n*** Error on opening file : " + filename );
System.exit(0);
}
catch( IOException ioe )
{ ioe.printStackTrace();
System.out.println( "\n\n*** Error reading file : " + filename );
System.exit(0);
}
catch( ClassNotFoundException cnf )
{ cnf.printStackTrace();
System.out.println( "\n\n*** Error reading file : " + filename );
System.exit(0);
}
radar = new Radar( aircraft );
radio = new Radio( aircraft );
synchronized( aircraft )
{ for( int i = 0; i < aircraft.size(); i++ )
{ ((Aircraft)(aircraft.elementAt(i))).addObserver( radio );
}
}
new ProximityDetector( aircraft );