Mercurial > hg > mep
comparison SubjectResults.java @ 45:351b0c8b34ac
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 "<Participant ID>_qu.dat" (previously was "subjects.dat". Would have been overwritten as wasn't dynamic.
author | Carl Bussey <c.bussey@se10.qmul.ac.uk> |
---|---|
date | Sun, 09 Jun 2013 22:06:52 +0100 |
parents | 0e030f32a6e2 |
children |
comparison
equal
deleted
inserted
replaced
44:a80321f83468 | 45:351b0c8b34ac |
---|---|
19 private Experiment exp; | 19 private Experiment exp; |
20 | 20 |
21 /* accessors */ | 21 /* accessors */ |
22 public String getSubjectID() { return subjectID; } | 22 public String getSubjectID() { return subjectID; } |
23 public void setSubjectID(String id) { subjectID = id; } | 23 public void setSubjectID(String id) { subjectID = id; } |
24 public void setSubjectData (ArrayList sd) { subjectData = sd; } | 24 public void setSubjectData (ArrayList sd) { subjectData = sd; } |
25 public void setSubjectDataFile(String id){ | |
26 subjectDataFile = new File(exp.RESULTS_DIRECTORY + File.separator + id + "_q" + exp.RESULTS_EXTENSION); | |
27 } | |
25 public void setOutputFile (String id) { | 28 public void setOutputFile (String id) { |
26 outputFile = new File(exp.RESULTS_DIRECTORY + id + | 29 outputFile = new File(exp.RESULTS_DIRECTORY + id + |
27 exp.RESULTS_EXTENSION); | 30 exp.RESULTS_EXTENSION); |
28 } | 31 } |
29 | 32 |
30 /* constructor */ | 33 /* constructor */ |
31 public SubjectResults(Experiment e) { | 34 public SubjectResults(Experiment e) { |
32 exp = e; | 35 exp = e; |
33 subjectDataFile = new File(exp.SUBJECT_RESULTS_FILE); | 36 //subjectDataFile = new File(exp.SUBJECT_RESULTS_FILE); |
34 results = new ArrayList(); | 37 results = new ArrayList(); |
35 subjectData = new ArrayList(); | 38 subjectData = new ArrayList(); |
36 } | 39 } |
37 | 40 |
38 /* methods */ | 41 /* methods */ |
39 public void addResult(MelodyResults mr) { | 42 public void addResult(MelodyResults mr) { |
40 results.add(mr); | 43 results.add(mr); |
57 public void writeSubjectData () { | 60 public void writeSubjectData () { |
58 Writer writer = null; | 61 Writer writer = null; |
59 try { | 62 try { |
60 writer = new FileWriter (subjectDataFile, true); | 63 writer = new FileWriter (subjectDataFile, true); |
61 } catch (IOException e) { | 64 } catch (IOException e) { |
62 System.out.println("Could not write file: " + outputFile.getPath()); | 65 System.out.println("Could not write file: " + subjectDataFile.getPath()); |
66 e.printStackTrace(); | |
63 return; | 67 return; |
64 } | 68 } |
65 | 69 |
66 try { | 70 try { |
67 Iterator sji = subjectData.iterator(); | 71 Iterator sji = subjectData.iterator(); |