2 * TrialDataDynamic.java
6 import java
.awt
.geom
.Point2D
;
7 import java
.util
.HashSet
;
8 import java
.util
.Random
;
10 public class TrialDataDynamic
{
14 public TrialDataDynamic() {
19 * An array of aircraft operator prefixes.
21 final private String
[] callsign_prefixes
= {
22 "SWA", "AAL", "UAL", "COA", "DAL", "FDX", "NWA", "UPS", "SKW",
23 "ACA", "BTA", "AWE", "JBU", "USA", "ASA", "TRS", "BAW", "ABX",
24 "EGF", "DLH", "WJA", "AFR", "ASH", "ASQ", "AMF", "FFT", "FLG",
25 "COM", "JZA", "CHQ", "QXE", "KLM", "DHL", "MES", "HAL", "USC",
26 "LOF", "VIR", "CJC", "KAL", "JIA", "VRD", "NKS", "TSC", "RPA",
27 "TCF", "CPA", "AWI", "IBE", "MXA", "EJA", "AZA", "SWR", "MEP",
28 "PEN", "LBQ", "GLA", "EIN", "CAL", "AAY", "AMX", "TCX", "MPH",
29 "CCI", "FLX", "BKA", "JAZ", "AIC", "GJS", "JAL", "ANA", "SCX",
30 "MTN", "FTA", "PDT", "LTU", "CPZ", "REX", "AJM", "MPE", "SIA",
31 "ICE", "SAS", "AEA", "CRL", "SKQ", "CMI", "CLX", "FIV", "TAI",
32 "MRA", "CJT", "ELY", "EVA", "NCB", "PCO", "ATN", "TOM", "CFG",
33 "AAR", "LAN", "MAL", "GTI", "JAI", "ERH", "CMP", "AUA", "RZO",
34 "GSM", "SWG", "AVA", "THT", "WAE", "SNC", "WIG", "LOT", "CCA",
35 "AFL", "XLA", "FRL", "GLR", "TAM", "FCA", "UAE", "GWY", "SVX",
36 "MDS", "SAA", "CWC", "BMA", "CAV", "DCS", "LAL", "OOM", "MUI",
37 "OAL", "KFA", "LYM", "WEW", "CTA", "BBR", "HKI", "MKU", "IWD",
38 "WIS", "RAM", "CPT", "CGC", "SUB", "FAB", "FIN", "CUB", "VTS",
39 "CGL", "CLA", "WAV", "ADH", "RJA", "AAH", "CKK", "SSX", "ANZ",
40 "WOA", "TAP", "THU", "VPB", "LNX", "CES", "KAP", "LPE", "GGN",
41 "NWD", "EXA", "WWI", "CHH", "PCE", "CAP", "SLI", "APW", "ACT",
42 "VPA", "CAO", "THY", "WIA", "CNK", "CGR", "CFN", "FPG", "APC",
43 "FWL", "GRC", "TFL", "UKZ", "NMI", "PRO", "ASP", "CON", "EMD",
44 "ETH", "SSV", "GCO", "AJT", "DNJ", "FRE", "BXR", "TAG", "BVN",
45 "BOS", "CKS", "PRY", "PAC", "PGX", "PAG", "NOA", "JDC", "AIP",
46 "BLS", "GLT", "MAH", "BXH", "CFC", "SQC", "VAL", "MAS", "ARG",
47 "MAX", "CGN", "NRL", "LNE", "ETD", "GUN", "OAE", "QTR", "EJM",
48 "ANT", "NDU", "ISR", "TWY", "MSR", "CCY", "OPT", "TEC", "PWA",
49 "LRC", "BOE", "MPD", "QFA", "CFZ", "CJA", "AVI", "CSA", "GEC",
54 * Generate a set of random callsigns using a random prefix from
55 * "callsign_prefixes" and a random 3 digit number.
57 * @param count The number of callsigns to generate.
58 * @return A HashSet of callsigns.
60 HashSet
<String
> generate_callsigns( int count
) {
61 HashSet
<String
> callsigns
= new HashSet
<String
>( count
);
62 while ( callsigns
.size() < count
) {
63 int randomInt
= rand
.nextInt( callsign_prefixes
.length
);
64 int callsign_suffix
= 0;
65 while ( callsign_suffix
< 100 ) {
66 callsign_suffix
= rand
.nextInt( 1000 );
68 callsigns
.add( callsign_prefixes
[randomInt
] +
69 String
.valueOf( callsign_suffix
) );
75 * Generate a set of random coordinates between 0.0 and 1.0.
77 * @param count The number of coordinates to generate.
78 * @return A HashSet of coordinates.
80 HashSet
<Point2D
.Double
> generate_coordinates( int count
) {
81 HashSet
<Point2D
.Double
> coordinates
=
82 new HashSet
<Point2D
.Double
>( count
);
83 while ( coordinates
.size() < count
) {
84 double x
= rand
.nextDouble();
85 double y
= rand
.nextDouble();
86 Point2D
.Double point
= new Point2D
.Double();
87 point
.setLocation(x
, y
);
88 coordinates
.add( point
);