package uk.ac.leeds.ccg.cluster; /** Mantel test parameters class */ import java.io.*; import java.awt.*; import java.awt.event.*; public class MantelTimeParameters extends SpaceTimeParameters { // Version id private static final String version = "$id$"; // Members // Constructors public MantelTimeParameters(){ setDefaultSpaceTimeParameters(); } public MantelTimeParameters(File file) throws IOException,FileNotFoundException{ // Read into a stream tokenised buffered input stream StreamTokenizer st = new StreamTokenizer ( new BufferedReader ( new InputStreamReader ( new FileInputStream (file)))); System.out.println ("Setting Mantel parameters from "+file); st.nextToken(); if (st.sval.equalsIgnoreCase("true")) {setAnimate(true);} else {setAnimate(false);} st.nextToken(); setNumRuns((int)st.nval); st.nextToken(); setSignificanceThreshold(st.nval); } public MantelTimeParameters(boolean animate, int numRuns, double thresh){ setAnimate(animate); setNumRuns(numRuns); setSignificanceThreshold(thresh); } // Methods public String toString(){ return "[animate "+getAnimate()+"]\n"+ "[Number of runs "+getNumRuns()+"]\n"; } public void setTimeParameters(boolean animate, int numRuns, double thresh){ setAnimate(animate); setNumRuns(numRuns); setSignificanceThreshold(thresh); } public void setDefaultSpaceTimeParameters(){ super.setDefaultSpaceTimeParameters(); } public void writeSpaceTimeParameters(File file) throws IOException,FileNotFoundException{ PrintWriter pw = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream (file)))); pw.println(getAnimate()); pw.println(getNumRuns()); pw.println(getSignificanceThreshold()); System.out.println ("SpaceTimeParameters saved to "+file); pw.flush(); pw.close(); } }