import java.awt.*; import java.awt.event.*; import java.io.*; //import com.sun.java.util.collections.*; //change for 1.2! import java.net.*; import java.util.*; // aelfred parser import com.microstar.xml.*; import uk.ac.leeds.ccg.cluster.*; import uk.ac.leeds.ccg.geotools.*; import uk.ac.leeds.ccg.widgets.*; /** * a fairly simple wrapper to hold gam and bessag and newell classes and to provide an interface to * other methods as developed Ian 24/5/00 */ public class Cluster extends Parser implements ActionListener{ Frame frame; GridBagLayout gridBagLayout; GridBagConstraints gridBagConstraints; TextArea messagesTextArea; ProgressBar progressBar; MenuBar menuBar; Menu fileMenu; Menu selectMenu; Menu statstestMenu; Menu parametersMenu; Menu runMenu; Menu displayMenu; Menu selectSpatialMenu; Menu selectTimeMenu; Menu selectSpaceTimeMenu; MenuItem loadDataFileMenuItem; MenuItem loadDatabaseMenuItem; MenuItem loadTimeSeriesMenuItem; MenuItem quitMenuItem; MenuItem selectGamMethodMenuItem; MenuItem loadShapefileMenuItem; MenuItem selectKnnMethodMenuItem; MenuItem selectRandomMethodMenuItem; MenuItem selectSpatscanMethodMenuItem; MenuItem selectScanMethodMenuItem; MenuItem selectECellsMethodMenuItem; MenuItem selectKnoxMethodMenuItem; MenuItem selectMantelMethodMenuItem; MenuItem selectKnn_STMethodMenuItem; MenuItem selectSpattimescanMethodMenuItem; MenuItem selectLarsenMethodMenuItem; MenuItem selectGrimsonMethodMenuItem; MenuItem selectPoisMethodMenuItem; MenuItem selectBootMethodMenuItem; MenuItem selectMonteMethodMenuItem; MenuItem setParametersMenuItem; MenuItem runMenuItem; MenuItem displayDatabaseMenuItem; MenuItem displayTimeSeriesMenuItem; MenuItem displayResultsMenuItem; MenuItem displayGeographicLayerMenuItem; //Method method = new Gamk(); Method method; GeoRectangle searchRectangle = null; //Database database = new Database(); Database database; DatabaseViewer databaseViewer; TimeSeriesViewer timeseriesViewer; SignificanceTest significanceTest; Parameters parameters; ResViewer resViewer; Theme theme = null; File file; FileDialog fileDialog; FileFil fileFil; public Cluster (){ // Set frame frame = new Frame ("Cluster Hunter"); // Set fileDialog fileDialog = new FileDialog (frame); // Set menuBar menuBar = new MenuBar (); frame.setMenuBar (menuBar); // fileMenu fileMenu = new Menu ("File"); loadDataFileMenuItem = new MenuItem ("Load Data File"); loadDataFileMenuItem.setActionCommand ("load data file"); loadDataFileMenuItem.addActionListener (this); fileMenu.add (loadDataFileMenuItem); loadDatabaseMenuItem = new MenuItem ("Load Database"); loadDatabaseMenuItem.setActionCommand ("load database"); loadDatabaseMenuItem.addActionListener (this); fileMenu.add (loadDatabaseMenuItem); loadShapefileMenuItem = new MenuItem ("Load Database from Shapefile"); loadShapefileMenuItem.setActionCommand ("load shapefile"); loadShapefileMenuItem.addActionListener (this); fileMenu.add (loadShapefileMenuItem); loadTimeSeriesMenuItem = new MenuItem ("Load Time Series"); loadTimeSeriesMenuItem.setActionCommand ("load time series"); loadTimeSeriesMenuItem.addActionListener (this); fileMenu.add (loadTimeSeriesMenuItem); quitMenuItem = new MenuItem ("Quit"); quitMenuItem.setActionCommand ("quit"); quitMenuItem.addActionListener (this); fileMenu.add (quitMenuItem); menuBar.add (fileMenu); // selectMenu selectMenu = new Menu ("Select"); selectSpatialMenu = new Menu ("Spatial"); selectMenu.add (selectSpatialMenu); selectTimeMenu = new Menu ("Time"); selectMenu.add (selectTimeMenu); selectSpaceTimeMenu = new Menu ("SpaceTime"); selectMenu.add (selectSpaceTimeMenu); menuBar.add (selectMenu); // selectSpatialMenu // selectSpatialMenu = new Menu("Select"); selectGamMethodMenuItem = new MenuItem ("Gam"); selectGamMethodMenuItem.setActionCommand ("gam"); selectGamMethodMenuItem.addActionListener (this); selectGamMethodMenuItem.setEnabled (false); selectSpatialMenu.add (selectGamMethodMenuItem); selectKnnMethodMenuItem = new MenuItem ("Knn"); selectKnnMethodMenuItem.setActionCommand ("knn"); selectKnnMethodMenuItem.addActionListener (this); selectKnnMethodMenuItem.setEnabled (false); selectSpatialMenu.add (selectKnnMethodMenuItem); selectRandomMethodMenuItem = new MenuItem ("Random"); selectRandomMethodMenuItem.setActionCommand ("random"); selectRandomMethodMenuItem.addActionListener (this); selectRandomMethodMenuItem.setEnabled (false); selectSpatialMenu.add (selectRandomMethodMenuItem); selectSpatialMenu.add(selectRandomMethodMenuItem); selectSpatscanMethodMenuItem = new MenuItem("Spatial Scan"); selectSpatscanMethodMenuItem.setActionCommand("spatscan"); selectSpatscanMethodMenuItem.addActionListener(this); selectSpatscanMethodMenuItem.setEnabled(false); selectSpatialMenu.add(selectSpatscanMethodMenuItem); // menuBar.add(selectSpatialMenu); // selectTimeMenu // selectTimeMenu = new Menu("Select"); selectScanMethodMenuItem = new MenuItem ("Scan"); selectScanMethodMenuItem.setActionCommand ("scan"); selectScanMethodMenuItem.addActionListener (this); selectScanMethodMenuItem.setEnabled (false); selectTimeMenu.add (selectScanMethodMenuItem); selectECellsMethodMenuItem = new MenuItem ("Empty Cells"); selectECellsMethodMenuItem.setActionCommand ("ecells"); selectECellsMethodMenuItem.addActionListener (this); selectECellsMethodMenuItem.setEnabled (false); selectTimeMenu.add (selectECellsMethodMenuItem); selectLarsenMethodMenuItem = new MenuItem ("Larsen"); selectLarsenMethodMenuItem.setActionCommand ("larsen"); selectLarsenMethodMenuItem.addActionListener (this); selectLarsenMethodMenuItem.setEnabled (false); selectTimeMenu.add (selectLarsenMethodMenuItem); selectGrimsonMethodMenuItem = new MenuItem ("Grimson"); selectGrimsonMethodMenuItem.setActionCommand ("grimson"); selectGrimsonMethodMenuItem.addActionListener (this); selectGrimsonMethodMenuItem.setEnabled (false); selectTimeMenu.add (selectGrimsonMethodMenuItem); // menuBar.add(selectTimeMenu); // selectSpaceTimeMenu // selectSpaceTimeMenu = new Menu("Select"); selectKnoxMethodMenuItem = new MenuItem ("Knox"); selectKnoxMethodMenuItem.setActionCommand ("knox"); selectKnoxMethodMenuItem.addActionListener (this); selectKnoxMethodMenuItem.setEnabled (false); selectSpaceTimeMenu.add (selectKnoxMethodMenuItem); selectKnn_STMethodMenuItem = new MenuItem ("Knn_ST"); selectKnn_STMethodMenuItem.setActionCommand ("knn_st"); selectKnn_STMethodMenuItem.addActionListener (this); selectKnn_STMethodMenuItem.setEnabled (false); selectSpaceTimeMenu.add (selectKnn_STMethodMenuItem); selectMantelMethodMenuItem = new MenuItem ("Mantel"); selectMantelMethodMenuItem.setActionCommand ("mantel"); selectMantelMethodMenuItem.addActionListener (this); selectMantelMethodMenuItem.setEnabled (false); selectSpaceTimeMenu.add (selectMantelMethodMenuItem); selectSpattimescanMethodMenuItem = new MenuItem("Spattimescan"); selectSpattimescanMethodMenuItem.setActionCommand("spattimescan"); selectSpattimescanMethodMenuItem.addActionListener(this); selectSpattimescanMethodMenuItem.setEnabled(false); selectSpaceTimeMenu.add(selectSpattimescanMethodMenuItem); // menuBar.add(selectSpaceTimeMenu); // parametersMenu parametersMenu = new Menu ("Parameters"); setParametersMenuItem = new MenuItem ("Set Parameters"); setParametersMenuItem.setActionCommand ("set parameters"); setParametersMenuItem.addActionListener (this); setParametersMenuItem.setEnabled (false); parametersMenu.add (setParametersMenuItem); menuBar.add (parametersMenu); // statstestMenu statstestMenu = new Menu ("Stats Test"); selectPoisMethodMenuItem = new MenuItem ("Poisson"); selectPoisMethodMenuItem.setActionCommand ("pois"); selectPoisMethodMenuItem.addActionListener (this); selectPoisMethodMenuItem.setEnabled (false); statstestMenu.add (selectPoisMethodMenuItem); selectBootMethodMenuItem = new MenuItem ("Bootstrap"); selectBootMethodMenuItem.setActionCommand ("boot"); selectBootMethodMenuItem.addActionListener (this); selectBootMethodMenuItem.setEnabled (false); statstestMenu.add (selectBootMethodMenuItem); selectMonteMethodMenuItem = new MenuItem ("Monte Carlo"); selectMonteMethodMenuItem.setActionCommand ("monte"); selectMonteMethodMenuItem.addActionListener (this); selectMonteMethodMenuItem.setEnabled (false); statstestMenu.add (selectMonteMethodMenuItem); menuBar.add (statstestMenu); // runMenu runMenu = new Menu ("Run"); runMenuItem = new MenuItem ("Go"); runMenuItem.setActionCommand ("go"); runMenuItem.addActionListener (this); runMenuItem.setEnabled (false); runMenu.add (runMenuItem); menuBar.add (runMenu); // displayMenu displayMenu = new Menu ("Display"); displayDatabaseMenuItem = new MenuItem ("Display Database"); displayDatabaseMenuItem.setActionCommand ("display database"); displayDatabaseMenuItem.addActionListener (this); displayDatabaseMenuItem.setEnabled (false); displayMenu.add (displayDatabaseMenuItem); displayTimeSeriesMenuItem = new MenuItem ("Display Time Series"); displayTimeSeriesMenuItem.setActionCommand ("display timeseries"); displayTimeSeriesMenuItem.addActionListener (this); displayTimeSeriesMenuItem.setEnabled (false); displayMenu.add (displayTimeSeriesMenuItem); displayResultsMenuItem = new MenuItem ("Display Results"); displayResultsMenuItem.setActionCommand ("display results"); displayResultsMenuItem.addActionListener (this); displayResultsMenuItem.setEnabled (false); displayMenu.add (displayResultsMenuItem); displayGeographicLayerMenuItem = new MenuItem ("Display Geographic Layer"); displayGeographicLayerMenuItem.setActionCommand ("display geographic layer"); displayGeographicLayerMenuItem.addActionListener (this); displayMenu.add (displayGeographicLayerMenuItem); menuBar.add (displayMenu); // Set messagesTextArea messagesTextArea = new TextArea ("Messages\n"); messagesTextArea.setEditable (false); frame.add (messagesTextArea); } public static void main (String[] args) { if (args.length == 0) { Cluster cluster = new Cluster (); cluster.run (); } if (args.length == 1) { // use command file Cluster cluster = new Cluster (); cluster.loadXML (args[0]); return; } } public void loadXML (String filename){ //frame.pack (); //frame.setVisible (true); File f = new File (System.getProperty ("user.dir"),filename); if(!f.canRead()){ System.out.println("Can not read input file: "+f.toString()); System.exit(1); } URL url = null; try{ url= f.toURL(); //new URL ("file:///"+System.getProperty ("user.dir")+"/"+filename); }catch (MalformedURLException mue){ System.err.println ("Bad filename in cluster\n"+mue.toString ()); return; } System.out.println("about to parse " + url.toString ()); parseXML (url); ActionEvent av = new ActionEvent (this,0,"go"); this.actionPerformed (av); // export results ??? //av = new ActionEvent (this,0,"display results"); //this.actionPerformed (av); Results results = method.getResults (); System.out.println("results " + results.getSize () + " circles\n"); if (results.getSize () == 0) { System.out.println("No circles found"); frame.dispose (); System.exit(0); } resViewer = new ResViewer(); results.setBounds (database.getBounds ()); resViewer.setResults(results,500.0); resViewer.writeAscii(outputfile); if(imagefile!=null){ resViewer.writeJpeg(imagefile); String base = imagefile.getAbsolutePath()+".bbox"; try{ OutputStream os = new FileOutputStream(base); PrintWriter pw = new PrintWriter(os); pw.write("\n\t"+resViewer.getRasterBBox()+"\n"); pw.close(); }catch (IOException ioe){ System.err.println("Problem writing image\n"+ioe.toString()); } } System.out.println("finished"); frame.dispose (); System.exit(0); } // element types for xml parser static final int NONE=0; static final int CLUSTER=1; static final int DATA = 2; static final int TEXTFILE = 3; static final int METHOD =4; static final int GAM = 5; static final int MINRAD = 6; static final int MAXRAD = 7; static final int RADSTEP = 8; static final int OVERLP = 9; static final int STATISTIC = 10; static final int SIGNIF = 11; static final int MINPOP = 12; static final int MININC = 13; static final int MINPTS = 14; static final int STATTYPE = 15; static final int POISSON = 16; static final int KNN = 17; static final int RANDOM = 18; static final int OUTPUT = 19; static final int NEIGHBOURS = 20; static final int NOCIRCLES = 21; static final int SPATSCAN = 30; static final int SCAN = 31; static final int ECELLS = 32; static final int LARSEN = 33; static final int GRIMSON = 34; static final int KNOX = 35; static final int KNN_ST = 36; static final int MANTEL = 37; static final int SPATTIMESCAN = 38; static final int NUMRUNS = 40; static final int NUMBIN = 41; static final int STARTTIME = 42; static final int ENDTIME = 43; static final int W = 44; static final int FILT_STEP = 45; static final int HR = 46; static final int DELTA = 47; static final int TAU = 48; static final int K = 49; static final int TIMEMIN = 50; static final int TIMEMAX = 51; static final int TIMEINC = 52; static final int BOUNDS = 60; static final int TEXT = 100; static final int IMAGE = 101; static final int BOOTSTRAP = 102; static final int MONTE = 103; static final int MAXSAMP = 104; static final int SHAPEFILE = 105; static final int FILENAME = 106; static final int POPCOL = 107; static final int CASECOL = 108; static final int IDCOL = 109; private int currentElement = NONE; private void setElementType (String ename){ currentElement = NONE; if(ename.equalsIgnoreCase ("Textfile")) currentElement=TEXTFILE; if(ename.equalsIgnoreCase ("Method")) currentElement=METHOD; if(ename.equalsIgnoreCase ("gam")) currentElement=GAM; if(ename.equalsIgnoreCase ("knn")) currentElement=KNN; if(ename.equalsIgnoreCase ("random")) currentElement=RANDOM; if(ename.equalsIgnoreCase ("MinRadius")) currentElement=MINRAD; if(ename.equalsIgnoreCase ("MaxRadius")) currentElement=MAXRAD; if(ename.equalsIgnoreCase ("RadiusStep")) currentElement=RADSTEP; if(ename.equalsIgnoreCase ("Overlap")) currentElement=OVERLP; if(ename.equalsIgnoreCase ("Statistic")) currentElement=STATISTIC; if(ename.equalsIgnoreCase ("Significance")) currentElement=SIGNIF; if(ename.equalsIgnoreCase ("MinimumPop")) currentElement=MINPOP; if(ename.equalsIgnoreCase ("MinimumIncidence")) currentElement=MININC; if(ename.equalsIgnoreCase ("MinimumNumberOfPoints")) currentElement=MINPTS; if(ename.equalsIgnoreCase ("StatisticType")) currentElement=STATTYPE; if(ename.equalsIgnoreCase ("MaximumSampleSize")) currentElement=MAXSAMP; if(ename.equalsIgnoreCase ("Poisson")) currentElement=POISSON; if(ename.equalsIgnoreCase ("bootstrap")) currentElement=BOOTSTRAP; if(ename.equalsIgnoreCase ("montecarlo")) currentElement=MONTE; if(ename.equalsIgnoreCase ("Output")) currentElement=OUTPUT; if(ename.equalsIgnoreCase ("Neighbours")) currentElement=NEIGHBOURS; if(ename.equalsIgnoreCase ("Nocircles")) currentElement=NOCIRCLES; if(ename.equalsIgnoreCase ("Spatscan")) currentElement=SPATSCAN; if(ename.equalsIgnoreCase ("Scan")) currentElement=SCAN; if(ename.equalsIgnoreCase ("Ecells")) currentElement=ECELLS; if(ename.equalsIgnoreCase ("Larsen")) currentElement=LARSEN; if(ename.equalsIgnoreCase ("Grimson")) currentElement=GRIMSON; if(ename.equalsIgnoreCase ("Knox")) currentElement=KNOX; if(ename.equalsIgnoreCase ("Knn_st")) currentElement=KNN_ST; if(ename.equalsIgnoreCase ("Mantel")) currentElement=MANTEL; if(ename.equalsIgnoreCase ("Spattimescan")) currentElement=SPATTIMESCAN; if(ename.equalsIgnoreCase ("numRuns")) currentElement=NUMRUNS; if(ename.equalsIgnoreCase ("numBin")) currentElement=NUMBIN; if(ename.equalsIgnoreCase ("minTime")) currentElement=STARTTIME; if(ename.equalsIgnoreCase ("maxTime")) currentElement=ENDTIME; if(ename.equalsIgnoreCase ("W")) currentElement=W; if(ename.equalsIgnoreCase ("filt_step")) currentElement=FILT_STEP; if(ename.equalsIgnoreCase ("highrisk")) currentElement=HR; if(ename.equalsIgnoreCase ("delta")) currentElement=DELTA; if(ename.equalsIgnoreCase ("tau")) currentElement=TAU; if(ename.equalsIgnoreCase ("K")) currentElement=K; if(ename.equalsIgnoreCase ("timeMin")) currentElement=TIMEMIN; if(ename.equalsIgnoreCase ("timeMax")) currentElement=TIMEMAX; if(ename.equalsIgnoreCase ("timeInc")) currentElement=TIMEINC; if(ename.equalsIgnoreCase ("bbox")) currentElement=BOUNDS; if(ename.equalsIgnoreCase ("Text")) currentElement=TEXT; if(ename.equalsIgnoreCase ("Image")) currentElement=IMAGE; if(ename.equalsIgnoreCase ("Shapefile")) currentElement=SHAPEFILE; if(ename.equalsIgnoreCase ("FileName")) currentElement=FILENAME; if(ename.equalsIgnoreCase ("Population")) currentElement=POPCOL; if(ename.equalsIgnoreCase ("Cases")) currentElement=CASECOL; if(ename.equalsIgnoreCase ("IdColumn")) currentElement=IDCOL; } public void startElement (String elname) throws java.lang.Exception { ActionEvent ae; //System.out.println("starting "+elname); setElementType (elname); if(currentElement==CLUSTER){ // do nothing } if(currentElement==GAM){ ae = new ActionEvent (this,0,"gam"); this.actionPerformed (ae); gam=true; } if(currentElement==KNN){ ae = new ActionEvent (this,0,"knn"); this.actionPerformed (ae); knn=true; } if(currentElement==RANDOM){ ae = new ActionEvent (this,0,"random"); this.actionPerformed (ae); random=true; } if(currentElement==SPATSCAN){ ae = new ActionEvent (this,0,"spatscan"); this.actionPerformed (ae); spatscan=true; } if(currentElement==SCAN){ ae = new ActionEvent (this,0,"scan"); this.actionPerformed (ae); scan=true; } if(currentElement==ECELLS){ ae = new ActionEvent (this,0,"ecells"); this.actionPerformed (ae); ecells=true; } if(currentElement==LARSEN){ ae = new ActionEvent (this,0,"larsen"); this.actionPerformed (ae); larsen=true; } if(currentElement==GRIMSON){ ae = new ActionEvent (this,0,"grimson"); this.actionPerformed (ae); grimson=true; } if(currentElement==KNOX){ ae = new ActionEvent (this,0,"knox"); this.actionPerformed (ae); knox=true; } if(currentElement==KNN_ST){ ae = new ActionEvent (this,0,"knn_st"); this.actionPerformed (ae); knn_st=true; } if(currentElement==MANTEL){ ae = new ActionEvent (this,0,"mantel"); this.actionPerformed (ae); mantel=true; } if(currentElement==SPATTIMESCAN){ ae = new ActionEvent (this,0,"spattimescan"); this.actionPerformed (ae); spattimescan=true; } if(currentElement==POISSON){ System.out.println ("setting Poisson statistic"); ae = new ActionEvent (this,0,"poisson"); actionPerformed (ae); } if(currentElement==BOOTSTRAP){ bootstrap = true; System.out.println ("setting bootstrap"); ae = new ActionEvent (this,0,"bootstrap"); actionPerformed (ae); } if(currentElement==MONTE){ monte =true; System.out.println ("setting Monte Carlo statistic"); ae = new ActionEvent (this,0,"monte"); actionPerformed (ae); } if(currentElement==SHAPEFILE){ shape=true; System.out.println ("reading shapefile"); } } // true if the method being read is GAM boolean gam = false; // true if the method being read is KNN boolean knn = false; // true if the method being read is RANDOM boolean random = false; // true if the method being read is SPATSCAN boolean spatscan = false; // true if the method being read is SCAN boolean scan = false; // true if the method being read is ECELLS boolean ecells = false; // true if the method being read is LARSEN boolean larsen = false; // true if the method being read is GRIMSON boolean grimson = false; // true if the method being read is KNOX boolean knox = false; // true if the method being read is KNN_ST boolean knn_st = false; // true if the method being read is MANTEL boolean mantel = false; // true if the method being read is SPATIMESCAN boolean spattimescan = false; boolean bootstrap = false; boolean monte = false; boolean shape = false; int idcol = -1; public void endElement (String elname) throws java.lang.Exception { setElementType (elname); if(currentElement==TEXTFILE){ loadTextData (datafile); } if(currentElement==SHAPEFILE){ database = new Database(); if(idcol == -1){ database.loadShapefile (datafile, popcol, casecol); } else { // there is an id col provided database.loadShapefile (datafile, idcol, popcol, casecol); } database.convertToRates (); } } File datafile = null; File outputfile = null; File imagefile = null; String popcol="",casecol=""; public void charData (char ch[], int start, int length) throws java.lang.Exception { String text = new String (ch, start, length).trim(); if(text.equals ("")) return; double d; //System.out.println("parsing " + text); switch (currentElement) { case FILENAME: datafile = new File(System.getProperty ("user.dir"),text); break; case TEXT: outputfile = new File(System.getProperty ("user.dir"),text); break; case IMAGE: imagefile = new File(System.getProperty ("user.dir"),text); break; case POPCOL: popcol = text; break; case CASECOL: casecol = text; break; case IDCOL: idcol = Integer.parseInt (text); break; case BOUNDS: StringTokenizer stok = new StringTokenizer(text," ,"); int i = 0; double[] coord = new double[4]; while(stok.hasMoreTokens () && i < 4){ coord[i] = Double.parseDouble (stok.nextToken ()); System.out.println(""+i+":"+coord[i]); i++; } searchRectangle = new GeoRectangle(coord[0], coord[1], coord[2]-coord[0], coord[3] - coord[1]); if(method != null) { method.setSearch (searchRectangle); } System.out.println("Setting search to " + searchRectangle.toString ()); break; case MINRAD: d = Double.parseDouble (text); if(gam){ ((GamParameters)parameters).setRadMin (d); }else if(random){ ((RandomParameters)parameters).setRadMin (d); }else if(spatscan){ ((SpatscanParameters)parameters).setRadMin (d); }else if(spattimescan){ ((SpattimescanParameters)parameters).setRadMin (d); } break; case MAXRAD: d = Double.parseDouble (text); if(gam){ ((GamParameters)parameters).setRadMax (d); }else if(random){ ((RandomParameters)parameters).setRadMax (d); }else if(spatscan){ ((SpatscanParameters)parameters).setRadMax (d); }else if(spattimescan){ ((SpattimescanParameters)parameters).setRadMax (d); } break; case OVERLP: if(gam){ d = Double.parseDouble (text); ((GamParameters)parameters).setOverlp (d); } break; case RADSTEP: d = Double.parseDouble (text); if(gam){ ((GamParameters)parameters).setRadInc (d); }else if(spatscan){ ((SpatscanParameters)parameters).setRadInc (d); }else if(spattimescan){ ((SpattimescanParameters)parameters).setRadInc (d); } break; case NEIGHBOURS: if(knn){ d = Double.parseDouble (text); ((KnnParameters)parameters).setK ((int)d); } break; case NUMRUNS: d = Double.parseDouble (text); if(spatscan){ ((SpatscanParameters)parameters).setNumRuns ((int)d); }else if(knox){ ((KnoxTimeParameters)parameters).setNumRuns ((int)d); }else if(knn_st){ ((Knn_STTimeParameters)parameters).setNumRuns ((int)d); }else if(mantel){ ((MantelTimeParameters)parameters).setNumRuns ((int)d); }else if(spattimescan){ ((SpattimescanParameters)parameters).setNumRuns ((int)d); } break; case NUMBIN: d = Double.parseDouble (text); if(scan){ ((ScanTimeParameters)parameters).setNumBin ((int)d); }else if(ecells){ ((ECellsTimeParameters)parameters).setNumBin ((int)d); }else if(larsen){ ((LarsenTimeParameters)parameters).setNumBin ((int)d); }else if(grimson){ ((GrimsonTimeParameters)parameters).setNumBin ((int)d); } break; case STARTTIME: d = Double.parseDouble (text); if(scan){ ((ScanTimeParameters)parameters).setStartTime ((int)d); }else if(ecells){ ((ECellsTimeParameters)parameters).setStartTime ((int)d); }else if(larsen){ ((LarsenTimeParameters)parameters).setStartTime ((int)d); }else if(grimson){ ((GrimsonTimeParameters)parameters).setStartTime ((int)d); } break; case ENDTIME: d = Double.parseDouble (text); if(scan){ ((ScanTimeParameters)parameters).setEndTime ((int)d); }else if(ecells){ ((ECellsTimeParameters)parameters).setEndTime ((int)d); }else if(larsen){ ((LarsenTimeParameters)parameters).setEndTime ((int)d); }else if(grimson){ ((GrimsonTimeParameters)parameters).setEndTime ((int)d); } break; case W: if(scan){ d = Double.parseDouble (text); ((ScanTimeParameters)parameters).setW ((int)d); } break; case HR: if(grimson){ d = Double.parseDouble (text); ((GrimsonTimeParameters)parameters).setHR (d); } break; case NOCIRCLES: if(random){ d = Double.parseDouble (text); ((RandomParameters)parameters).setNCircles ((int)d); } break; case DELTA: if (knox){ d = Double.parseDouble (text); ((KnoxTimeParameters)parameters).setDelta ((int)d); } case TAU: if (knox){ d = Double.parseDouble (text); ((KnoxTimeParameters)parameters).setTau ((int)d); } case K: if (knn_st){ d = Double.parseDouble (text); ((Knn_STTimeParameters)parameters).setK ((int)d); } case TIMEMIN: if (spattimescan){ d = Double.parseDouble (text); ((SpattimescanParameters)parameters).setTimeMin (d); } case TIMEMAX: if (spattimescan){ d = Double.parseDouble (text); ((SpattimescanParameters)parameters).setTimeMax (d); } case TIMEINC: if (spattimescan){ d = Double.parseDouble (text); ((SpattimescanParameters)parameters).setTimeInc (d); } case SIGNIF: d = Double.parseDouble (text); parameters.setSignificanceThreshold (d); break; case MINPOP: d = Double.parseDouble (text); parameters.setMinPopSize (d); break; case MININC: d = Double.parseDouble (text); parameters.setMinIncidenceCount (d); break; case MINPTS: d = Double.parseDouble (text); parameters.setMinPointCount ((int)d); break; case STATTYPE: d = Double.parseDouble (text); parameters.setStatType ((int)d); break; case MAXSAMP: d = Double.parseDouble (text); if(monte) parameters.setMonteCarloSampleSize((int)d); if(bootstrap) parameters.setBootstrapSampleSize((int)d); break; } } public void run () { frame.pack (); frame.setVisible (true); } public void actionPerformed (ActionEvent actionEvent) { String actionCommand = actionEvent.getActionCommand (); if (actionCommand.equalsIgnoreCase ("quit")) { System.exit (0); } if (actionCommand.equalsIgnoreCase ("load data file")) { frame = new Frame (); fileDialog.setTitle ("Load data file"); fileFil = new FileFil (fileDialog, ".dat"); fileDialog.setFilenameFilter (fileFil); fileDialog.setVisible (true); // work out which file they chose. if (fileDialog.getFile () == null) { return; } file = new File (fileDialog.getDirectory (), fileDialog.getFile ()); loadTextData (file); } if (actionCommand.equalsIgnoreCase ("load database")) { frame = new Frame (); fileDialog = new FileDialog (frame); fileDialog.setTitle ("Load database"); fileFil = new FileFil (fileDialog, ".dbc"); fileDialog.setFilenameFilter (fileFil); fileDialog.setVisible (true); // work out which file they chose. if (fileDialog.getFile () == null) { return; } file = new File (fileDialog.getDirectory (), fileDialog.getFile ()); messagesTextArea.append ("Loading Database " + file + "\n"); database = new Database (); database.load (file); messagesTextArea.append (database.getSize () + " points " + database.getNumberCases () + " cases\n"); displayDatabaseMenuItem.setEnabled (true); displayTimeSeriesMenuItem.setEnabled (false); selectGamMethodMenuItem.setEnabled (true); selectKnnMethodMenuItem.setEnabled (true); selectRandomMethodMenuItem.setEnabled (true); selectSpatscanMethodMenuItem.setEnabled(true); selectScanMethodMenuItem.setEnabled (false); selectECellsMethodMenuItem.setEnabled (false); selectLarsenMethodMenuItem.setEnabled (false); selectGrimsonMethodMenuItem.setEnabled (false); selectKnoxMethodMenuItem.setEnabled (false); selectKnn_STMethodMenuItem.setEnabled (false); selectMantelMethodMenuItem.setEnabled (false); selectSpattimescanMethodMenuItem.setEnabled(true); //runMenuItem.setEnabled(true); } if (actionCommand.equalsIgnoreCase ("load shapefile")) { fileDialog = new FileDialog (frame); fileDialog.setTitle ("Load database"); fileFil = new FileFil (fileDialog, ".shp"); fileDialog.setFilenameFilter (fileFil); fileDialog.setVisible (true); // work out which file they chose. if (fileDialog.getFile () == null) { return; } file = new File (fileDialog.getDirectory (), fileDialog.getFile ()); messagesTextArea.append ("Loading Database " + file + "\n"); database = new Database (); database.loadShapefile (file.toString (), frame); messagesTextArea.append (database.getSize () + " points " + database.getNumberCases () + " cases\n"); database.convertToRates (); displayDatabaseMenuItem.setEnabled (true); displayTimeSeriesMenuItem.setEnabled (false); selectGamMethodMenuItem.setEnabled (true); selectKnnMethodMenuItem.setEnabled (true); selectRandomMethodMenuItem.setEnabled (true); selectSpatscanMethodMenuItem.setEnabled(true); selectScanMethodMenuItem.setEnabled (false); selectECellsMethodMenuItem.setEnabled (false); selectLarsenMethodMenuItem.setEnabled (false); selectGrimsonMethodMenuItem.setEnabled (false); selectKnoxMethodMenuItem.setEnabled (false); selectKnn_STMethodMenuItem.setEnabled (false); selectMantelMethodMenuItem.setEnabled (false); selectSpattimescanMethodMenuItem.setEnabled(false); //runMenuItem.setEnabled(true); loadShapefile(file); } if (actionCommand.equalsIgnoreCase ("load time series")) { frame = new Frame (); fileDialog = new FileDialog (frame); fileDialog.setTitle ("Load time series"); fileFil = new FileFil (fileDialog, ".tim"); fileDialog.setFilenameFilter (fileFil); fileDialog.setVisible (true); // work out which file they chose. if (fileDialog.getFile () == null) { return; } file = new File (fileDialog.getDirectory (), fileDialog.getFile ()); messagesTextArea.append ("Loading time series " + file + "\n"); database = new Database (); database.loadText (file); messagesTextArea.append (database.getSize () + " points " + database.getNumberCases () + " cases\n"); displayDatabaseMenuItem.setEnabled (false); if (timeseriesViewer != null) { timeseriesViewer.setDatabase (database); } // displayTimeSeriesMenuItem.setEnabled(true); selectGamMethodMenuItem.setEnabled (false); selectKnnMethodMenuItem.setEnabled (false); selectRandomMethodMenuItem.setEnabled (false); selectSpatscanMethodMenuItem.setEnabled(false); selectScanMethodMenuItem.setEnabled (true); selectECellsMethodMenuItem.setEnabled (true); selectLarsenMethodMenuItem.setEnabled (true); selectGrimsonMethodMenuItem.setEnabled (true); selectKnoxMethodMenuItem.setEnabled (true); selectKnn_STMethodMenuItem.setEnabled (true); selectMantelMethodMenuItem.setEnabled (true); selectSpattimescanMethodMenuItem.setEnabled(false); //runMenuItem.setEnabled(true); } if (actionCommand.equalsIgnoreCase ("display database")) { frame = new Frame ("DataViewer " + database.getName ()); databaseViewer = new DatabaseViewer (frame); databaseViewer.setDatabase (database); if (theme != null) { databaseViewer.addGeography (theme); } frame.setMenuBar (databaseViewer.getMenuBar ()); frame.add (databaseViewer); frame.pack (); frame.setVisible (true); } if (actionCommand.equalsIgnoreCase ("display timeseries")) { frame = new Frame ("TimeSeriesViewer " + database.getName ()); // this will let you view the time series without choosing a time series method, but there's no control over the parameters!! // if (method == null){ // method = new Scan(); // parameters=method.getParameters(); // } timeseriesViewer = new TimeSeriesViewer (frame, (TimeParameters) parameters); timeseriesViewer.setDatabase (database); if (theme != null) { timeseriesViewer.addGeography (theme); } frame.setMenuBar (timeseriesViewer.getMenuBar ()); frame.add (timeseriesViewer); frame.pack (); frame.setVisible (true); } if (actionCommand.equalsIgnoreCase ("display geographic layer")) { fileDialog.setTitle ("Load shapefile"); fileFil = new FileFil (fileDialog, ".shp"); fileDialog.setFilenameFilter (fileFil); fileDialog.setVisible (true); // work out which file they chose. if (fileDialog.getFile () == null) { return; } file = new File (fileDialog.getDirectory (), fileDialog.getFile ()); System.out.println ("File = " + file); try { String name = file.getCanonicalPath (); int i = name.lastIndexOf (".shp"); ShapefileReader shapefileReader = new ShapefileReader (name.substring (0, i)); theme = shapefileReader.getTheme (); theme.setStyle (new ShadeStyle (false, true, null, Color.black, true)); System.out.println ("" + theme); if (databaseViewer != null) { databaseViewer.addGeography (theme); } if (resViewer != null) { resViewer.addGeography (theme); } } catch (FileNotFoundException e1) {} catch (IOException e2) { System.err.println ("File read error"); return; } } if (actionCommand.equalsIgnoreCase ("gam")) { method = new Gamk (); selectGamMethodMenuItem.setLabel ("Gam *"); selectKnnMethodMenuItem.setLabel ("Knn"); selectRandomMethodMenuItem.setLabel ("Random"); selectSpatscanMethodMenuItem.setLabel("Spatial Scan"); selectSpatscanMethodMenuItem.setLabel("Spatial Scan"); messagesTextArea.append ("" + method + " " + database + " " + method.getSignificanceTest () + "\n"); //method.setSearch (searchRectangle); parameters = method.getParameters (); setParametersMenuItem.setEnabled (true); selectPoisMethodMenuItem.setEnabled (true); selectBootMethodMenuItem.setEnabled (true); selectMonteMethodMenuItem.setEnabled (true); runMenuItem.setEnabled (true); } if (actionCommand.equalsIgnoreCase ("knn")) { method = new Knn (); selectGamMethodMenuItem.setLabel ("Gam"); selectKnnMethodMenuItem.setLabel ("Knn *"); selectRandomMethodMenuItem.setLabel ("Random"); selectSpatscanMethodMenuItem.setLabel("Spatial Scan"); messagesTextArea.append ("" + method + " " + database + " " + method.getSignificanceTest () + "\n"); //method.setSearch (searchRectangle); parameters = method.getParameters (); setParametersMenuItem.setEnabled (true); selectPoisMethodMenuItem.setEnabled (true); selectBootMethodMenuItem.setEnabled (true); selectMonteMethodMenuItem.setEnabled (true); runMenuItem.setEnabled (true); } if (actionCommand.equalsIgnoreCase ("random")) { method = new uk.ac.leeds.ccg.cluster.Random (); selectGamMethodMenuItem.setLabel ("Gam"); selectKnnMethodMenuItem.setLabel ("Knn"); selectRandomMethodMenuItem.setLabel ("Random *"); selectSpatscanMethodMenuItem.setLabel("Spatial Scan"); messagesTextArea.append ("" + method + " " + database + " " + method.getSignificanceTest () + "\n"); //method.setSearch (searchRectangle); parameters = method.getParameters (); setParametersMenuItem.setEnabled (true); selectPoisMethodMenuItem.setEnabled (true); selectBootMethodMenuItem.setEnabled (true); selectMonteMethodMenuItem.setEnabled (true); runMenuItem.setEnabled (true); } if(actionCommand.equalsIgnoreCase("spatscan")){ method = new Spatscan(); selectGamMethodMenuItem.setLabel("Gam"); selectKnnMethodMenuItem.setLabel("Knn"); selectRandomMethodMenuItem.setLabel("Random"); selectSpatscanMethodMenuItem.setLabel("Spatial Scan *"); messagesTextArea.append(""+method+" "+database+" "+method.getSignificanceTest()+"\n"); parameters=method.getParameters(); setParametersMenuItem.setEnabled(true); selectPoisMethodMenuItem.setEnabled(true); selectBootMethodMenuItem.setEnabled(true); selectMonteMethodMenuItem.setEnabled(true); runMenuItem.setEnabled(true); } if (actionCommand.equalsIgnoreCase ("scan")) { method = new Scan (); selectScanMethodMenuItem.setLabel ("Scan *"); selectECellsMethodMenuItem.setLabel ("ECells"); selectLarsenMethodMenuItem.setLabel ("Larsen"); selectGrimsonMethodMenuItem.setLabel ("Grimson"); messagesTextArea.append ("" + method + " " + database + " " + method.getSignificanceTest () + "\n"); parameters = method.getParameters (); setParametersMenuItem.setEnabled (true); // selectPoisMethodMenuItem.setEnabled(true); // selectBootMethodMenuItem.setEnabled(true); // selectMonteMethodMenuItem.setEnabled(true); displayTimeSeriesMenuItem.setEnabled (true); runMenuItem.setEnabled (true); } if (actionCommand.equalsIgnoreCase ("ecells")) { method = new ECells (); selectScanMethodMenuItem.setLabel ("Scan"); selectECellsMethodMenuItem.setLabel ("ECells *"); selectLarsenMethodMenuItem.setLabel ("Larsen"); selectGrimsonMethodMenuItem.setLabel ("Grimson"); messagesTextArea.append ("" + method + " " + database + " " + method.getSignificanceTest () + "\n"); parameters = method.getParameters (); setParametersMenuItem.setEnabled (true); // selectPoisMethodMenuItem.setEnabled(true); // selectBootMethodMenuItem.setEnabled(true); // selectMonteMethodMenuItem.setEnabled(true); displayTimeSeriesMenuItem.setEnabled (true); runMenuItem.setEnabled (true); } if (actionCommand.equalsIgnoreCase ("larsen")) { method = new Larsen (); selectScanMethodMenuItem.setLabel ("Scan"); selectECellsMethodMenuItem.setLabel ("ECells"); selectLarsenMethodMenuItem.setLabel ("Larsen *"); selectGrimsonMethodMenuItem.setLabel ("Grimson"); messagesTextArea.append ("" + method + " " + database + " " + method.getSignificanceTest () + "\n"); parameters = method.getParameters (); setParametersMenuItem.setEnabled (true); // selectPoisMethodMenuItem.setEnabled(true); // selectBootMethodMenuItem.setEnabled(true); // selectMonteMethodMenuItem.setEnabled(true); displayTimeSeriesMenuItem.setEnabled (true); runMenuItem.setEnabled (true); } if (actionCommand.equalsIgnoreCase ("grimson")) { method = new Grimson (); selectScanMethodMenuItem.setLabel ("Scan"); selectECellsMethodMenuItem.setLabel ("ECells"); selectLarsenMethodMenuItem.setLabel ("Larsen"); selectGrimsonMethodMenuItem.setLabel ("Grimson *"); messagesTextArea.append ("" + method + " " + database + " " + method.getSignificanceTest () + "\n"); parameters = method.getParameters (); setParametersMenuItem.setEnabled (true); // selectPoisMethodMenuItem.setEnabled(true); // selectBootMethodMenuItem.setEnabled(true); // selectMonteMethodMenuItem.setEnabled(true); displayTimeSeriesMenuItem.setEnabled (true); runMenuItem.setEnabled (true); } if (actionCommand.equalsIgnoreCase ("knox")) { method = new Knox (); selectKnoxMethodMenuItem.setLabel ("Knox *"); selectKnn_STMethodMenuItem.setLabel ("Knn_ST"); selectMantelMethodMenuItem.setLabel ("Mantel"); selectSpattimescanMethodMenuItem.setLabel("Spatial Time Scan"); messagesTextArea.append ("" + method + " " + database + " " + method.getSignificanceTest () + "\n"); parameters = method.getParameters (); setParametersMenuItem.setEnabled (true); // selectPoisMethodMenuItem.setEnabled(true); // selectBootMethodMenuItem.setEnabled(true); // selectMonteMethodMenuItem.setEnabled(true); displayTimeSeriesMenuItem.setEnabled (true); runMenuItem.setEnabled (true); } if (actionCommand.equalsIgnoreCase ("knn_st")) { method = new Knn_ST (); selectKnoxMethodMenuItem.setLabel ("Knox"); selectKnn_STMethodMenuItem.setLabel ("Knn_ST *"); selectMantelMethodMenuItem.setLabel ("Mantel"); selectSpattimescanMethodMenuItem.setLabel("Spatial Time Scan"); messagesTextArea.append ("" + method + " " + database + " " + method.getSignificanceTest () + "\n"); parameters = method.getParameters (); setParametersMenuItem.setEnabled (true); // selectPoisMethodMenuItem.setEnabled(true); // selectBootMethodMenuItem.setEnabled(true); // selectMonteMethodMenuItem.setEnabled(true); displayTimeSeriesMenuItem.setEnabled (true); runMenuItem.setEnabled (true); } if (actionCommand.equalsIgnoreCase ("mantel")) { method = new Mantel (); selectKnoxMethodMenuItem.setLabel ("Knox"); selectKnn_STMethodMenuItem.setLabel ("Knn_ST"); selectMantelMethodMenuItem.setLabel ("Mantel *"); selectSpattimescanMethodMenuItem.setLabel("Spatial Time Scan"); messagesTextArea.append ("" + method + " " + database + " " + method.getSignificanceTest () + "\n"); parameters = method.getParameters (); setParametersMenuItem.setEnabled (true); // selectPoisMethodMenuItem.setEnabled(true); // selectBootMethodMenuItem.setEnabled(true); // selectMonteMethodMenuItem.setEnabled(true); displayTimeSeriesMenuItem.setEnabled (true); runMenuItem.setEnabled (true); } if(actionCommand.equalsIgnoreCase("spattimescan")){ method = new Spattimescan(); selectKnoxMethodMenuItem.setLabel("Knox"); selectKnn_STMethodMenuItem.setLabel("Knn_ST"); selectMantelMethodMenuItem.setLabel("Mantel"); selectSpattimescanMethodMenuItem.setLabel("Spatial Time Scan *"); messagesTextArea.append(""+method+" "+database+" "+method.getSignificanceTest()+"\n"); parameters=method.getParameters(); setParametersMenuItem.setEnabled(true); // selectPoisMethodMenuItem.setEnabled(true); // selectBootMethodMenuItem.setEnabled(true); // selectMonteMethodMenuItem.setEnabled(true); displayTimeSeriesMenuItem.setEnabled(true); runMenuItem.setEnabled(true); } if (actionCommand.equalsIgnoreCase ("pois") || actionCommand.equalsIgnoreCase ("Poisson")) { significanceTest = new PoissonTest (); method.setSignificanceTest (significanceTest); selectPoisMethodMenuItem.setLabel ("Poisson *"); selectBootMethodMenuItem.setLabel ("Bootstrap"); selectMonteMethodMenuItem.setLabel ("Monte Carlo"); messagesTextArea.append ("" + method + " " + significanceTest + "\n"); } if (actionCommand.equalsIgnoreCase ("boot") || actionCommand.equalsIgnoreCase ("bootstrap")) { parameters = method.getParameters (); significanceTest = new BootstrapTest (); method.setSignificanceTest (significanceTest); selectPoisMethodMenuItem.setLabel ("Poisson"); selectBootMethodMenuItem.setLabel ("Bootstrap *"); selectMonteMethodMenuItem.setLabel ("Monte Carlo"); messagesTextArea.append ("" + method + " " + significanceTest + "\n"); } if (actionCommand.equalsIgnoreCase ("monte") || actionCommand.equalsIgnoreCase ("monte carlo")) { parameters = method.getParameters (); significanceTest = new MontecarloTest (database); // sigtest = new Monte(); method.setSignificanceTest (significanceTest); selectPoisMethodMenuItem.setLabel ("Poisson"); selectBootMethodMenuItem.setLabel ("Bootstrap"); selectMonteMethodMenuItem.setLabel ("Monte Carlo *"); messagesTextArea.append ("" + method + " " + significanceTest + "\n"); } if (actionCommand.equalsIgnoreCase ("set parameters")) { method.getParametersViewer ().run (); if (significanceTest != null) { significanceTest.setParameters (method.getParameters ()); } messagesTextArea.append ("Set " + method + " Parameters\n" + method.getParameters ()); } if (actionCommand.equalsIgnoreCase ("go")) { method.setData (database); messagesTextArea.append ("" + method + " " + database + " " + method.getSignificanceTest () + "\n"); messagesTextArea.append ("" + method + " running\n"); messagesTextArea.append ("" + method + " Parameters\n" + method.getParameters ()); System.out.println("" + method + " " + database + " " + method.getSignificanceTest () + "\n"); System.out.println("" + method + " Parameters\n" + method.getParameters ()); if(databaseViewer != null ){ GeoRectangle box = databaseViewer.getSearchBox(); if(box != null){ System.out.println("setting search to " + box); messagesTextArea.append ("setting search to " + box + "\n"); method.setSearch(box); } } //progressBar = new ProgressBar(100); //progressBar.setCompleted(0.0); //frame.add(progressBar); //method.addProgressEventListener(progressBar); Thread thread = new Thread (method); //thread.start(); method.run (); messagesTextArea.append ("finished " + method.getResults ().getSize () + "\n"); if(frame.isVisible ()) messagesTextArea.setCaretPosition (messagesTextArea.getText ().length ()); displayResultsMenuItem.setEnabled (true); } if (actionCommand.equalsIgnoreCase ("display results")) { frame = new Frame ("Results"); resViewer = new ResViewer (frame); Results results = method.getResults (); messagesTextArea.append ("results " + results.getSize () + " circles\n"); if (results.getSize () == 0) { return; } resViewer.setResults (results); if (theme != null) { resViewer.addGeography (theme); } frame.add (resViewer); frame.setMenuBar (resViewer.getMenuBar ()); frame.pack (); frame.setVisible (true); } } private void loadTextData (File file){ messagesTextArea.append ("Loading data file " + file + "\n"); database = new Database (); database.loadText (file); messagesTextArea.append (database.getSize () + " points " + database.getNumberCases () + " cases\n"); System.out.println(database.getSize () + " points " + database.getNumberCases () + " cases\n"); database.convertToRates (); displayDatabaseMenuItem.setEnabled (true); displayTimeSeriesMenuItem.setEnabled (false); selectGamMethodMenuItem.setEnabled (true); selectKnnMethodMenuItem.setEnabled (true); selectRandomMethodMenuItem.setEnabled (true); selectSpatscanMethodMenuItem.setEnabled(true); selectScanMethodMenuItem.setEnabled (false); selectECellsMethodMenuItem.setEnabled (false); selectLarsenMethodMenuItem.setEnabled (false); selectGrimsonMethodMenuItem.setEnabled (false); selectKnoxMethodMenuItem.setEnabled (false); selectKnn_STMethodMenuItem.setEnabled (false); selectMantelMethodMenuItem.setEnabled (false); selectSpattimescanMethodMenuItem.setEnabled(true); frame.pack (); //runMenuItem.setEnabled(true); } public void loadShapefile(File file){ database = new Database (); database.loadShapefile (file.toString (), frame); messagesTextArea.append (database.getSize () + " points " + database.getNumberCases () + " cases\n"); System.out.println(database.getSize () + " points " + database.getNumberCases () + " cases\n"); database.convertToRates (); displayDatabaseMenuItem.setEnabled (true); displayTimeSeriesMenuItem.setEnabled (false); selectGamMethodMenuItem.setEnabled (true); selectKnnMethodMenuItem.setEnabled (true); selectRandomMethodMenuItem.setEnabled (true); selectScanMethodMenuItem.setEnabled (false); selectECellsMethodMenuItem.setEnabled (false); selectLarsenMethodMenuItem.setEnabled (false); selectGrimsonMethodMenuItem.setEnabled (false); selectKnoxMethodMenuItem.setEnabled (false); selectKnn_STMethodMenuItem.setEnabled (false); selectMantelMethodMenuItem.setEnabled (false); //runMenuItem.setEnabled(true); } }