changeset 14:2adbc5fa3a9c

Allow user to specify results directory as a command line argument.
author Marcus Pearce <marcus.pearce@eecs.qmul.ac.uk>
date Tue, 17 Jan 2012 12:24:31 +0000
parents 3c2da30cbb93
children dec8e537cbf8
files Experiment.java
diffstat 1 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Experiment.java	Tue Jan 17 12:23:41 2012 +0000
+++ b/Experiment.java	Tue Jan 17 12:24:31 2012 +0000
@@ -2,7 +2,7 @@
  * File:       Experiment.java
  * Author:     Marcus Pearce <m.pearce@gold.ac.uk>
  * Created:    <2007-02-14 11:28:27 marcusp>
- * Time-stamp: <2011-11-10 12:56:55 marcusp>
+ * Time-stamp: <2012-01-16 17:10:48 marcusp>
  *=============================================================================
  */
 
@@ -16,15 +16,15 @@
     /* pathnames */ 
     private final String BASE_DIRECTORY = 
         new File("").getAbsolutePath() + File.separator; 
+    private final String DATA_DIRECTORY = 
+        BASE_DIRECTORY + "Data" + File.separator; 
 
-    public final String RESULTS_DIRECTORY = 
+    public String RESULTS_DIRECTORY = 
         BASE_DIRECTORY + "Results" + File.separator; 
-    public final String RESULTS_EXTENSION = ".dat"; 
-    public final String SUBJECT_RESULTS_FILE = 
+    public String RESULTS_EXTENSION = ".dat"; 
+    public String SUBJECT_RESULTS_FILE = 
         RESULTS_DIRECTORY + "subjects" + RESULTS_EXTENSION; 
 
-    private final String DATA_DIRECTORY = 
-        BASE_DIRECTORY + "Data" + File.separator; 
     public String INSTRUCTIONS_FILE = 
         DATA_DIRECTORY + "instructions.html"; 
 
@@ -102,7 +102,7 @@
     }
 
     /* Constructor */ 
-    public Experiment (int sc, int cu, int nu, int sl, int md, String la, String ha, String mfd, String inf, int fam, int lik, int quest) { 
+    public Experiment (int sc, int cu, int nu, int sl, int md, String la, String ha, String mfd, String inf, String rdr, int fam, int lik, int quest) { 
         
         // Setup variables 
         results = new SubjectResults(this); 
@@ -120,6 +120,9 @@
         MIDIFILELIST_FILE = MIDI_DIRECTORY + "filelist.txt"; 
         PRACTICE_MIDIFILELIST_FILE = MIDI_DIRECTORY + "pfilelist.txt"; 
         INSTRUCTIONS_FILE = inf;
+        RESULTS_DIRECTORY = rdr + File.separator;
+        SUBJECT_RESULTS_FILE = 
+            RESULTS_DIRECTORY + "subjects" + RESULTS_EXTENSION;
         
         if (fam == 0)
             askFamiliarity = false;
@@ -181,7 +184,7 @@
                                "<show clock?> <clock units> <number of units> " + 
                                "<midi device> " + 
                                "<scale length> <low anchor> <high anchor> " +
-                               "<midi file directory> <instructions file> " + 
+                               "<midi file directory> <instructions file> <results directory>" + 
                                "<familiarity>" + "<pleasantness>" + "<questionnaire>");
             System.exit(1);
         }
@@ -197,12 +200,13 @@
         String ha = args[n++];
         String mfd = args[n++];
         String inf = args[n++];
+        String rdr = args[n++];
         int fam = Integer.parseInt(args[n++]);
         int lik = Integer.parseInt(args[n++]);
         int quest = Integer.parseInt(args[n++]);
 
         // Create experiment 
-        Experiment exp = new Experiment(sc, cu, nu, sl, md, la, ha, mfd, inf, fam, lik, quest);
+        Experiment exp = new Experiment(sc, cu, nu, sl, md, la, ha, mfd, inf, rdr, fam, lik, quest);
         
         // Show the GUI 
         int width=(int)Toolkit.getDefaultToolkit().getScreenSize().getWidth();