Skip to content

Commit

Permalink
Converted floats to BigDecimals and more.
Browse files Browse the repository at this point in the history
Converted floats to BigDecimals for precision and to fix scientific
notation problems. Updated GUI display of last activity and start time
to human-readable dates.
  • Loading branch information
zackurben committed Jan 15, 2014
1 parent 6b926db commit 0e624c9
Show file tree
Hide file tree
Showing 9 changed files with 174 additions and 103 deletions.
2 changes: 0 additions & 2 deletions TODO.txt
@@ -1,3 +1 @@
Program TODO:
- Add program run-time to GUI version.
- Update the size of text boxes, in GUI version, due to MS Windows panel Sizing.
5 changes: 5 additions & 0 deletions changelog.txt
Expand Up @@ -13,3 +13,8 @@
- Added program runtime to Information Tab.
- Minor GUI tweaks to fix the interface on Windows machines.
- Code clean up.

1.0.3
- Converted floats to BigDecimals for precision
- Fixed bug where ReinvestorThread would crash due to floats being converted to scientific notation.
- Updated GUI Display of last activity and start time.
24 changes: 17 additions & 7 deletions src/Dashboard.java
Expand Up @@ -4,7 +4,7 @@
* under the Apache V2 License, which can be found at: gson/LICENSE.txt
*
* Dashboard.java
* Version : 1.0.2
* Version : 1.0.3
* Author : Zack Urben
* Contact : zackurben@gmail.com
* Creation : 12/31/13
Expand Down Expand Up @@ -33,6 +33,8 @@
import java.awt.Font;
import java.io.File;
import java.io.FileNotFoundException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.Scanner;
import javax.swing.JScrollPane;
Expand Down Expand Up @@ -87,6 +89,8 @@ public class Dashboard {
protected JTextPane TEXTPANE_CEX;
protected JTextPane TEXTPANE_CRYPTSY;
protected JScrollPane SCROLLPANE;
protected long NUM_START_TIME;
protected long NUM_LAST_ACTIVITY;
protected Reinvestor user;

/**
Expand Down Expand Up @@ -463,13 +467,19 @@ private void loadSettings() {
*/
private void updateSettings() {
this.user.BTC.active = CHECKBOX_BTC.isSelected();
this.user.BTC.reserve = Float.valueOf(INPUT_RESERVE_BTC.getText());
this.user.BTC.max = Float.valueOf(INPUT_MAX_BTC.getText());
this.user.BTC.min = Float.valueOf(INPUT_MIN_BTC.getText());
this.user.BTC.reserve = new BigDecimal(INPUT_RESERVE_BTC.getText())
.setScale(8, RoundingMode.DOWN);
this.user.BTC.max = new BigDecimal(INPUT_MAX_BTC.getText()).setScale(8,
RoundingMode.DOWN);
this.user.BTC.min = new BigDecimal(INPUT_MIN_BTC.getText()).setScale(8,
RoundingMode.DOWN);

this.user.NMC.active = CHECKBOX_NMC.isSelected();
this.user.NMC.reserve = Float.valueOf(INPUT_RESERVE_NMC.getText());
this.user.NMC.max = Float.valueOf(INPUT_MAX_NMC.getText());
this.user.NMC.min = Float.valueOf(INPUT_MIN_NMC.getText());
this.user.NMC.reserve = new BigDecimal(INPUT_RESERVE_NMC.getText())
.setScale(8, RoundingMode.DOWN);
this.user.NMC.max = new BigDecimal(INPUT_MAX_NMC.getText()).setScale(8,
RoundingMode.DOWN);
this.user.NMC.min = new BigDecimal(INPUT_MIN_NMC.getText()).setScale(8,
RoundingMode.DOWN);
}
}
4 changes: 2 additions & 2 deletions src/Login.java
Expand Up @@ -4,7 +4,7 @@
* under the Apache V2 License, which can be found at: gson/LICENSE.txt
*
* Login.java
* Version : 1.0.2
* Version : 1.0.3
* Author : Zack Urben
* Contact : zackurben@gmail.com
* Creation : 12/31/13
Expand Down Expand Up @@ -87,7 +87,7 @@ private void initialize() {
LABEL_VERSION.setBounds(312, 167, 47, 16);
PANEL.add(LABEL_VERSION);

LABEL_VERSION_NUMBER = new JLabel("1.0.2");
LABEL_VERSION_NUMBER = new JLabel("1.0.3");
LABEL_VERSION_NUMBER.setEnabled(false);
LABEL_VERSION_NUMBER.setBounds(371, 167, 61, 16);
PANEL.add(LABEL_VERSION_NUMBER);
Expand Down

0 comments on commit 0e624c9

Please sign in to comment.