chiark / gitweb /
make arbitrage calculation optional
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 4 Sep 2010 18:32:35 +0000 (19:32 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 4 Sep 2010 18:32:35 +0000 (19:32 +0100)
src/com/tedpearson/ypp/market/ControlPanel.java
src/com/tedpearson/ypp/market/MarketUploader.java

index ccdc7c6..62886c1 100644 (file)
@@ -19,6 +19,7 @@ public class ControlPanel extends JFrame {
                final Preferences prefs = Preferences.userNodeForPackage(getClass());
                final JCheckBox toPCTB = new JCheckBox("Upload to PCTB?", prefs.getBoolean("uploadToPCTB", true));
                final JCheckBox toYarrg = new JCheckBox("Upload to Yarrg?", prefs.getBoolean("uploadToYarrg", true));
+               final JCheckBox showArbitrage = new JCheckBox("Show arbitrage?", prefs.getBoolean("showArbitrage", false));
 
                final JRadioButton live = new JRadioButton("Use live servers");
                final JRadioButton testing = new JRadioButton("Use testing servers");
@@ -34,9 +35,10 @@ public class ControlPanel extends JFrame {
                    com.tedpearson.ypp.market.Version.version;
                JLabel version = new JLabel(version_label);
 
-               setLayout(new GridLayout(6,1));
+               setLayout(new GridLayout(7,1));
                add(toPCTB);
                add(toYarrg);
+               add(showArbitrage);
                add(live);
                add(testing);
                add(version);
@@ -49,6 +51,7 @@ public class ControlPanel extends JFrame {
                        public void actionPerformed(ActionEvent e) {
                                prefs.putBoolean("uploadToPCTB", toPCTB.isSelected());
                                prefs.putBoolean("uploadToYarrg", toYarrg.isSelected());
+                               prefs.putBoolean("showArbitrage", showArbitrage.isSelected());
                                prefs.putBoolean("useLiveServers", live.isSelected());
                                System.exit(exitstatus);
                        }
index 9aa8f04..11f085b 100644 (file)
@@ -55,6 +55,7 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis
 
        private boolean uploadToYarrg;
        private boolean uploadToPCTB;
+       private boolean showArbitrage;
 
        private String islandName = null;
        private String oceanName = null;
@@ -229,6 +230,7 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis
                
                uploadToYarrg=prefs.getBoolean("uploadToYarrg", true);
                uploadToPCTB=prefs.getBoolean("uploadToPCTB", true);
+               showArbitrage=prefs.getBoolean("showArbitrage", true);
 
                EventQueueMonitor.addTopLevelWindowListener(this);
                if (EventQueueMonitor.isGUIInitialized()) {
@@ -427,7 +429,7 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis
 
                ArrayList<ArrayList<String>> data = getData(accesstable);
 
-               if (false) {
+               if (showArbitrage) {
                        calculateArbitrage(data);
                }