changeset 3:6108a8aa9d82

Add command line option to turn off clock. Ignore-this: 1b88592bed48f4491e1563cccfbccbeb
author Marcus Pearce <m.pearce@gold.ac.uk>
date Mon, 21 Jun 2010 17:37:24 +0100
parents 1fe7ac28a3ca
children 5080b65e6963
files Experiment.java ExperimentGui.java README StimulusPanel.java runExperiment.bat
diffstat 5 files changed, 28 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/Experiment.java	Mon Jun 14 13:28:18 2010 +0100
+++ b/Experiment.java	Mon Jun 21 17:37:24 2010 +0100
@@ -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: <2010-06-08 16:18:32 marcusp>
+ * Time-stamp: <2010-06-21 16:51:26 marcusp>
  *=============================================================================
  */
 
@@ -38,6 +38,8 @@
     /* The GUI */ 
     private ExperimentGui gui; 
 
+    /* whether to show the clock */
+    private boolean showClock;
     /* the units of the clock as multiples of the tatum */
     private int clockUnits; 
     /* number of units that clock runs for before a probe event */ 
@@ -71,6 +73,7 @@
     public SubjectResults getSubjectResults() { return results; }
     public Block getCurrentBlock() { return blocks[currentBlockID]; }
     public int getCurrentBlockID() { return currentBlockID + 1; }
+    public boolean showClock() { return showClock; }
     public int getClockUnits() { return clockUnits; } 
     public int getNumUnits() { return numUnits; } 
     public String getInstructionsFile() { return INSTRUCTIONS_FILE; }
@@ -83,10 +86,14 @@
     }
 
     /* Constructor */ 
-    public Experiment (int cu, int nu, int sl, int md, String la, String ha) { 
+    public Experiment (int sc, int cu, int nu, int sl, int md, String la, String ha) { 
         
         // Setup variables 
         results = new SubjectResults(this); 
+        if (sc == 0) 
+            showClock = false;
+        else 
+            showClock = true;
         clockUnits = cu; 
         numUnits = nu; 
         scaleLength = sl;
@@ -138,13 +145,15 @@
     public static void main(String[] args) {
         if (args.length == 0) {
             System.out.println("Usage: " + "\t" + "java Experiment " + 
-                               "<clock units> <number of units> <midi device>" + 
-                               "<scale length> <midi device> <low anchor> <high anchor>"); 
+                               "<show clock?> <clock units> <number of units> " + 
+                               "<midi device> " + 
+                               "<scale length> <low anchor> <high anchor>"); 
             System.exit(1);
         }
         
         // Parse Arguments 
-        int n = 0; 
+        int n = 0;
+        int sc = Integer.parseInt(args[n++]); 
         int cu = Integer.parseInt(args[n++]); 
         int nu = Integer.parseInt(args[n++]); 
         int md = Integer.parseInt(args[n++]); 
@@ -153,7 +162,7 @@
         String ha = args[n++];
 
         // Create experiment 
-        Experiment exp = new Experiment(cu, nu, sl, md, la, ha);
+        Experiment exp = new Experiment(sc, cu, nu, sl, md, la, ha);
         
         // Show the GUI 
         int width=(int)Toolkit.getDefaultToolkit().getScreenSize().getWidth();
--- a/ExperimentGui.java	Mon Jun 14 13:28:18 2010 +0100
+++ b/ExperimentGui.java	Mon Jun 21 17:37:24 2010 +0100
@@ -2,7 +2,7 @@
  * File:       ExperimentGui.java
  * Author:     Marcus Pearce <m.pearce@gold.ac.uk>
  * Created:    <2007-02-14 16:42:31 marcusp>
- * Time-stamp: <2010-05-18 11:12:05 marcusp>
+ * Time-stamp: <2010-06-21 16:50:53 marcusp>
  *=============================================================================
  */
 
@@ -96,9 +96,11 @@
 
     /* Show the Clock */ 
     public void showClock() { 
-        clock.showClock = true; 
-        clock.showFullClock = false; 
-        clock.repaint(); 
+        if (exp.showClock()) {
+            clock.showClock = true;
+            clock.showFullClock = false; 
+            clock.repaint();
+        }
     } 
 
     /* Show the Fixation Point */ 
--- a/README	Mon Jun 14 13:28:18 2010 +0100
+++ b/README	Mon Jun 21 17:37:24 2010 +0100
@@ -5,11 +5,12 @@
 
 USAGE 
 
-  java Experiment <multiple> <n> <midi device> <scale length> <low anchor> <high anchor>
+  java Experiment <show clock?> <multiple> <n> <midi device> <scale length> <low anchor> <high anchor>
 
-where <multiple> and <n> are integers: the clock runs for <n> time
+where <show clock?> specifies whether to show the clock (0 = no; 1 =
+yes) and <multiple> and <n> are integers: the clock runs for <n> time
 units before a probed event where the time unit is a multiple of the
-tatum as specified by <multiple>. 
+tatum as specified by <multiple>.
 
 <midi device> is an integer specifying the midi device to use (usually 0).
 
--- a/StimulusPanel.java	Mon Jun 14 13:28:18 2010 +0100
+++ b/StimulusPanel.java	Mon Jun 21 17:37:24 2010 +0100
@@ -2,7 +2,7 @@
  * File:       StimulusPanel.java
  * Author:     Marcus Pearce <m.pearce@gold.ac.uk>
  * Created:    <2007-12-05 11:24:00 marcusp>
- * Time-stamp: <2010-05-18 11:12:14 marcusp>
+ * Time-stamp: <2010-06-21 16:50:59 marcusp>
  *=============================================================================
  */
 
@@ -78,7 +78,7 @@
         JPanel questionsPanel = new JPanel();
         GridLayout gl = new GridLayout(2,2); 
         gl.setHgap(50); 
-        questionsPanel.setLayout(gl); 
+         questionsPanel.setLayout(gl); 
         
         String[] q1BoxOptions = { "", "Yes", "No" }; 
         q1Box = new JComboBox(q1BoxOptions); 
--- a/runExperiment.bat	Mon Jun 14 13:28:18 2010 +0100
+++ b/runExperiment.bat	Mon Jun 21 17:37:24 2010 +0100
@@ -1,1 +1,1 @@
-java Experiment 1 4 0 7 "Highly unexpected" "Highly expected"
+java Experiment 1 1 4 0 7 "Highly unexpected" "Highly expected"