bnmjkm / opal

Automatically exported from code.google.com/p/opal
0 stars 0 forks source link

CalculatorCombo NPE discovered and three other observations noted #47

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
1) ModifyListener instances may never be invoked.  CalculatorCombo adds 
listeners directly to its CalculatorButtonsComposite. However, 
_displayHidePopupWindow clobbers its CalculatorButtonsComposite when the shell 
changes and any prior listeners added are lost.

2) Why does CalculatorCombo#setValue use Float to validate whereas 
CalculatorEngine uses Double?  Seems that CalculatorCombo should also use 
Double.

3) NPE results when the equal button is pressed before any operator has been 
pressed. CalculatorEngine#processLastOperator has obvious flaws.

Functionally, the design is peculiar. Seems that listeners should be notified 
only when equal is pressed and not on every numeric button press as is the case 
at this release.  When the popup is dismissed, the prior value should be 
restored. The calculator should not retain any prior intermediate state between 
popup invocations.  Always start with a clean slate.

Functionally there are many anomalies. e.g.

Five button sequence 6 * 9 sqrt = 
yields 9

There are many others.

there are many more.

Original issue reported on code.google.com by dkari...@gmail.com on 7 Aug 2015 at 6:42

GoogleCodeExporter commented 8 years ago
perhaps 
http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/EngineforCalculatorbyMichaelSc
hmidt.htm would make a better calculator engine.

Original comment by dkari...@gmail.com on 7 Aug 2015 at 6:51

GoogleCodeExporter commented 8 years ago
Issue moved to github at the following 
URL:https://github.com/lcaron/opal/issues/50

Original comment by laurent....@gmail.com on 8 Aug 2015 at 9:02