# HG changeset patch # User Carl Bussey # Date 1370812012 -3600 # Node ID 351b0c8b34ac25d0ca094afa0917aa80ec9b3ca8 # Parent a80321f83468c23d72329bf52bcbc1782f1c0f9e Fixed issue where error message was shown every time the user chose to move continue using the keyboard. Fixed issue where data wasn't saving to file after questionaire. Changed SubjectData output filename to "_qu.dat" (previously was "subjects.dat". Would have been overwritten as wasn't dynamic. diff -r a80321f83468 -r 351b0c8b34ac Experiment.class Binary file Experiment.class has changed diff -r a80321f83468 -r 351b0c8b34ac Experiment.java --- a/Experiment.java Fri Jun 07 18:28:39 2013 +0100 +++ b/Experiment.java Sun Jun 09 22:06:52 2013 +0100 @@ -99,7 +99,8 @@ public void setSubjectID(String id) { subjectID = id; results.setSubjectID(id); - results.setOutputFile(id); + results.setOutputFile(id); + results.setSubjectDataFile(id); getCurrentBlock().getMelodyResults().setSubjectID(id); System.out.println("Subject ID = " + subjectID); } @@ -125,8 +126,6 @@ PRACTICE_MIDIFILELIST_FILE = MIDI_DIRECTORY + "pfilelist.txt"; INSTRUCTIONS_FILE = inf; RESULTS_DIRECTORY = rdr + File.separator; - SUBJECT_RESULTS_FILE = - RESULTS_DIRECTORY + "subjects" + RESULTS_EXTENSION; if (fs == 0) fullScreen = false; @@ -217,6 +216,9 @@ /* Main method */ public static void main(String[] args) { + System.out.println("Working Directory = " + + System.getProperty("user.dir")); + if (args.length == 15) { // Parse Arguments diff -r a80321f83468 -r 351b0c8b34ac ExperimentController.class Binary file ExperimentController.class has changed diff -r a80321f83468 -r 351b0c8b34ac ExperimentController.java --- a/ExperimentController.java Fri Jun 07 18:28:39 2013 +0100 +++ b/ExperimentController.java Sun Jun 09 22:06:52 2013 +0100 @@ -19,7 +19,7 @@ SubjectResults results; InstructionsPanel ip; - StimulusPanel sp; + StimulusPanel sp; SubjectDataPanel sdp; InterBlockPanel ibp; @@ -112,7 +112,7 @@ // exp.runExperiment(); // else // reportError("You have already played the melody."); - } else if (source == sp.getNextButton()) { + } else if (source == sp.getNextButton()) { nextStimuli(block); } else { if (exp.getDebug()) @@ -135,6 +135,8 @@ public void keyPressed(KeyEvent e) { + showDefaultMessagePrompt(); + if (exp.getDebug()) System.out.println("Key pressed: " + e.getKeyChar()); long time = System.nanoTime(); @@ -203,7 +205,9 @@ } else if (sp.unansweredQuestions()) reportError("There are unanswered questions."); + else { + showDefaultMessagePrompt(); // store results (and write to file) if (exp.getAskFamiliarity()) { String answer1 = (String)(sp.getQ1Box().getSelectedItem()); diff -r a80321f83468 -r 351b0c8b34ac SubjectResults.class Binary file SubjectResults.class has changed diff -r a80321f83468 -r 351b0c8b34ac SubjectResults.java --- a/SubjectResults.java Fri Jun 07 18:28:39 2013 +0100 +++ b/SubjectResults.java Sun Jun 09 22:06:52 2013 +0100 @@ -21,18 +21,21 @@ /* accessors */ public String getSubjectID() { return subjectID; } public void setSubjectID(String id) { subjectID = id; } - public void setSubjectData (ArrayList sd) { subjectData = sd; } + public void setSubjectData (ArrayList sd) { subjectData = sd; } + public void setSubjectDataFile(String id){ + subjectDataFile = new File(exp.RESULTS_DIRECTORY + File.separator + id + "_q" + exp.RESULTS_EXTENSION); + } public void setOutputFile (String id) { - outputFile = new File(exp.RESULTS_DIRECTORY + id + + outputFile = new File(exp.RESULTS_DIRECTORY + id + exp.RESULTS_EXTENSION); } /* constructor */ public SubjectResults(Experiment e) { exp = e; - subjectDataFile = new File(exp.SUBJECT_RESULTS_FILE); + //subjectDataFile = new File(exp.SUBJECT_RESULTS_FILE); results = new ArrayList(); - subjectData = new ArrayList(); + subjectData = new ArrayList(); } /* methods */ @@ -59,7 +62,8 @@ try { writer = new FileWriter (subjectDataFile, true); } catch (IOException e) { - System.out.println("Could not write file: " + outputFile.getPath()); + System.out.println("Could not write file: " + subjectDataFile.getPath()); + e.printStackTrace(); return; }