Parcourir la source

CalcSkin Finished

NiraParikh il y a 6 ans
Parent
révision
3992f3e50f

BIN
.DS_Store Voir le fichier


BIN
src/.DS_Store Voir le fichier


+ 7
- 0
src/.idea/misc.xml Voir le fichier

@@ -0,0 +1,7 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="JavaScriptSettings">
4
+    <option name="languageLevel" value="ES6" />
5
+  </component>
6
+  <component name="ProjectRootManager" version="2" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
7
+</project>

+ 8
- 0
src/.idea/modules.xml Voir le fichier

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectModuleManager">
4
+    <modules>
5
+      <module fileurl="file://$PROJECT_DIR$/.idea/src.iml" filepath="$PROJECT_DIR$/.idea/src.iml" />
6
+    </modules>
7
+  </component>
8
+</project>

+ 6
- 0
src/.idea/vcs.xml Voir le fichier

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
+  </component>
6
+</project>

+ 368
- 0
src/.idea/workspace.xml Voir le fichier

@@ -0,0 +1,368 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ChangeListManager">
4
+    <list default="true" id="cd05fb34-d6e5-4208-bbe8-0499239b19e7" name="Default Changelist" comment="">
5
+      <change beforePath="$PROJECT_DIR$/main/java/rocks/zipcode/calcskin/CalcEngine.java" beforeDir="false" afterPath="$PROJECT_DIR$/main/java/rocks/zipcode/calcskin/CalcEngine.java" afterDir="false" />
6
+      <change beforePath="$PROJECT_DIR$/main/java/rocks/zipcode/calcskin/CalcSkin.java" beforeDir="false" afterPath="$PROJECT_DIR$/main/java/rocks/zipcode/calcskin/CalcSkin.java" afterDir="false" />
7
+      <change beforePath="$PROJECT_DIR$/test/java/rocks/zipcode/calcskin/CalcEngineTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/test/java/rocks/zipcode/calcskin/CalcEngineTest.java" afterDir="false" />
8
+    </list>
9
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
10
+    <option name="SHOW_DIALOG" value="false" />
11
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
12
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
13
+    <option name="LAST_RESOLUTION" value="IGNORE" />
14
+  </component>
15
+  <component name="FUSProjectUsageTrigger">
16
+    <session id="613893859">
17
+      <usages-collector id="statistics.lifecycle.project">
18
+        <counts>
19
+          <entry key="project.closed" value="2" />
20
+          <entry key="project.open.time.5" value="1" />
21
+          <entry key="project.open.time.8" value="1" />
22
+          <entry key="project.opened" value="2" />
23
+        </counts>
24
+      </usages-collector>
25
+      <usages-collector id="statistics.file.extensions.open">
26
+        <counts>
27
+          <entry key="java" value="4" />
28
+        </counts>
29
+      </usages-collector>
30
+      <usages-collector id="statistics.file.types.open">
31
+        <counts>
32
+          <entry key="JAVA" value="4" />
33
+        </counts>
34
+      </usages-collector>
35
+      <usages-collector id="statistics.file.extensions.edit">
36
+        <counts>
37
+          <entry key="java" value="89" />
38
+        </counts>
39
+      </usages-collector>
40
+      <usages-collector id="statistics.file.types.edit">
41
+        <counts>
42
+          <entry key="JAVA" value="89" />
43
+        </counts>
44
+      </usages-collector>
45
+    </session>
46
+  </component>
47
+  <component name="FileEditorManager">
48
+    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
49
+      <file pinned="false" current-in-tab="false">
50
+        <entry file="file://$PROJECT_DIR$/main/java/rocks/zipcode/calcskin/CalcSkin.java">
51
+          <provider selected="true" editor-type-id="text-editor">
52
+            <state relative-caret-position="471">
53
+              <caret line="198" column="13" lean-forward="true" selection-start-line="198" selection-start-column="13" selection-end-line="198" selection-end-column="13" />
54
+            </state>
55
+          </provider>
56
+        </entry>
57
+      </file>
58
+      <file pinned="false" current-in-tab="false">
59
+        <entry file="file://$PROJECT_DIR$/main/java/rocks/zipcode/calcskin/MainApplication.java">
60
+          <provider selected="true" editor-type-id="text-editor">
61
+            <state relative-caret-position="75">
62
+              <caret line="5" selection-start-line="5" selection-end-line="5" />
63
+            </state>
64
+          </provider>
65
+        </entry>
66
+      </file>
67
+      <file pinned="false" current-in-tab="true">
68
+        <entry file="file://$PROJECT_DIR$/test/java/rocks/zipcode/calcskin/CalcEngineTest.java">
69
+          <provider selected="true" editor-type-id="text-editor">
70
+            <state relative-caret-position="165">
71
+              <caret line="11" lean-forward="true" selection-start-line="11" selection-end-line="11" />
72
+              <folding>
73
+                <element signature="imports" expanded="true" />
74
+              </folding>
75
+            </state>
76
+          </provider>
77
+        </entry>
78
+      </file>
79
+      <file pinned="false" current-in-tab="false">
80
+        <entry file="file://$PROJECT_DIR$/main/java/rocks/zipcode/calcskin/CalcEngine.java">
81
+          <provider selected="true" editor-type-id="text-editor">
82
+            <state relative-caret-position="443">
83
+              <caret line="43" column="8" selection-start-line="43" selection-start-column="8" selection-end-line="43" selection-end-column="8" />
84
+            </state>
85
+          </provider>
86
+        </entry>
87
+      </file>
88
+    </leaf>
89
+  </component>
90
+  <component name="Git.Settings">
91
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
92
+  </component>
93
+  <component name="IdeDocumentHistory">
94
+    <option name="CHANGED_PATHS">
95
+      <list>
96
+        <option value="$PROJECT_DIR$/main/java/rocks/zipcode/calcskin/CalcEngine.java" />
97
+        <option value="$PROJECT_DIR$/main/java/rocks/zipcode/calcskin/CalcSkin.java" />
98
+        <option value="$PROJECT_DIR$/main/java/rocks/zipcode/calcskin/MainApplication.java" />
99
+      </list>
100
+    </option>
101
+  </component>
102
+  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
103
+  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
104
+  <component name="JsGulpfileManager">
105
+    <detection-done>true</detection-done>
106
+    <sorting>DEFINITION_ORDER</sorting>
107
+  </component>
108
+  <component name="ProjectFrameBounds">
109
+    <option name="x" value="22" />
110
+    <option name="y" value="23" />
111
+    <option name="width" value="1280" />
112
+    <option name="height" value="730" />
113
+  </component>
114
+  <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
115
+  <component name="ProjectView">
116
+    <navigator proportions="" version="1">
117
+      <foldersAlwaysOnTop value="true" />
118
+    </navigator>
119
+    <panes>
120
+      <pane id="Scope" />
121
+      <pane id="PackagesPane" />
122
+      <pane id="ProjectPane">
123
+        <subPane>
124
+          <expand>
125
+            <path>
126
+              <item name="src" type="b2602c69:ProjectViewProjectNode" />
127
+              <item name="src" type="462c0819:PsiDirectoryNode" />
128
+            </path>
129
+            <path>
130
+              <item name="src" type="b2602c69:ProjectViewProjectNode" />
131
+              <item name="src" type="462c0819:PsiDirectoryNode" />
132
+              <item name="main" type="462c0819:PsiDirectoryNode" />
133
+            </path>
134
+            <path>
135
+              <item name="src" type="b2602c69:ProjectViewProjectNode" />
136
+              <item name="src" type="462c0819:PsiDirectoryNode" />
137
+              <item name="main" type="462c0819:PsiDirectoryNode" />
138
+              <item name="java" type="462c0819:PsiDirectoryNode" />
139
+            </path>
140
+            <path>
141
+              <item name="src" type="b2602c69:ProjectViewProjectNode" />
142
+              <item name="src" type="462c0819:PsiDirectoryNode" />
143
+              <item name="main" type="462c0819:PsiDirectoryNode" />
144
+              <item name="java" type="462c0819:PsiDirectoryNode" />
145
+              <item name="rocks" type="462c0819:PsiDirectoryNode" />
146
+            </path>
147
+            <path>
148
+              <item name="src" type="b2602c69:ProjectViewProjectNode" />
149
+              <item name="src" type="462c0819:PsiDirectoryNode" />
150
+              <item name="main" type="462c0819:PsiDirectoryNode" />
151
+              <item name="java" type="462c0819:PsiDirectoryNode" />
152
+              <item name="rocks" type="462c0819:PsiDirectoryNode" />
153
+              <item name="zipcode" type="462c0819:PsiDirectoryNode" />
154
+            </path>
155
+            <path>
156
+              <item name="src" type="b2602c69:ProjectViewProjectNode" />
157
+              <item name="src" type="462c0819:PsiDirectoryNode" />
158
+              <item name="main" type="462c0819:PsiDirectoryNode" />
159
+              <item name="java" type="462c0819:PsiDirectoryNode" />
160
+              <item name="rocks" type="462c0819:PsiDirectoryNode" />
161
+              <item name="zipcode" type="462c0819:PsiDirectoryNode" />
162
+              <item name="calcskin" type="462c0819:PsiDirectoryNode" />
163
+            </path>
164
+            <path>
165
+              <item name="src" type="b2602c69:ProjectViewProjectNode" />
166
+              <item name="src" type="462c0819:PsiDirectoryNode" />
167
+              <item name="test" type="462c0819:PsiDirectoryNode" />
168
+            </path>
169
+            <path>
170
+              <item name="src" type="b2602c69:ProjectViewProjectNode" />
171
+              <item name="src" type="462c0819:PsiDirectoryNode" />
172
+              <item name="test" type="462c0819:PsiDirectoryNode" />
173
+              <item name="java" type="462c0819:PsiDirectoryNode" />
174
+            </path>
175
+            <path>
176
+              <item name="src" type="b2602c69:ProjectViewProjectNode" />
177
+              <item name="src" type="462c0819:PsiDirectoryNode" />
178
+              <item name="test" type="462c0819:PsiDirectoryNode" />
179
+              <item name="java" type="462c0819:PsiDirectoryNode" />
180
+              <item name="rocks" type="462c0819:PsiDirectoryNode" />
181
+            </path>
182
+            <path>
183
+              <item name="src" type="b2602c69:ProjectViewProjectNode" />
184
+              <item name="src" type="462c0819:PsiDirectoryNode" />
185
+              <item name="test" type="462c0819:PsiDirectoryNode" />
186
+              <item name="java" type="462c0819:PsiDirectoryNode" />
187
+              <item name="rocks" type="462c0819:PsiDirectoryNode" />
188
+              <item name="zipcode" type="462c0819:PsiDirectoryNode" />
189
+            </path>
190
+            <path>
191
+              <item name="src" type="b2602c69:ProjectViewProjectNode" />
192
+              <item name="src" type="462c0819:PsiDirectoryNode" />
193
+              <item name="test" type="462c0819:PsiDirectoryNode" />
194
+              <item name="java" type="462c0819:PsiDirectoryNode" />
195
+              <item name="rocks" type="462c0819:PsiDirectoryNode" />
196
+              <item name="zipcode" type="462c0819:PsiDirectoryNode" />
197
+              <item name="calcskin" type="462c0819:PsiDirectoryNode" />
198
+            </path>
199
+          </expand>
200
+          <select />
201
+        </subPane>
202
+      </pane>
203
+    </panes>
204
+  </component>
205
+  <component name="PropertiesComponent">
206
+    <property name="WebServerToolWindowFactoryState" value="false" />
207
+    <property name="aspect.path.notification.shown" value="true" />
208
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1541649813616" />
209
+    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
210
+    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
211
+    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
212
+    <property name="project.structure.last.edited" value="Project" />
213
+    <property name="project.structure.proportion" value="0.0" />
214
+    <property name="project.structure.side.proportion" value="0.0" />
215
+  </component>
216
+  <component name="RunDashboard">
217
+    <option name="ruleStates">
218
+      <list>
219
+        <RuleState>
220
+          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
221
+        </RuleState>
222
+        <RuleState>
223
+          <option name="name" value="StatusDashboardGroupingRule" />
224
+        </RuleState>
225
+      </list>
226
+    </option>
227
+  </component>
228
+  <component name="SvnConfiguration">
229
+    <configuration />
230
+  </component>
231
+  <component name="TaskManager">
232
+    <task active="true" id="Default" summary="Default task">
233
+      <changelist id="cd05fb34-d6e5-4208-bbe8-0499239b19e7" name="Default Changelist" comment="" />
234
+      <created>1541649213608</created>
235
+      <option name="number" value="Default" />
236
+      <option name="presentableId" value="Default" />
237
+      <updated>1541649213608</updated>
238
+      <workItem from="1541649217570" duration="62000" />
239
+      <workItem from="1541649385998" duration="429000" />
240
+    </task>
241
+    <servers />
242
+  </component>
243
+  <component name="TimeTrackingManager">
244
+    <option name="totallyTimeSpent" value="491000" />
245
+  </component>
246
+  <component name="ToolWindowManager">
247
+    <frame x="22" y="23" width="1280" height="730" extended-state="0" />
248
+    <editor active="true" />
249
+    <layout>
250
+      <window_info content_ui="combo" id="Project" order="0" weight="0.2536349" />
251
+      <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
252
+      <window_info id="Image Layers" order="2" />
253
+      <window_info id="Designer" order="3" />
254
+      <window_info id="UI Designer" order="4" />
255
+      <window_info id="Capture Tool" order="5" />
256
+      <window_info id="Favorites" order="6" side_tool="true" />
257
+      <window_info anchor="bottom" id="Message" order="0" />
258
+      <window_info anchor="bottom" id="Find" order="1" />
259
+      <window_info anchor="bottom" id="Run" order="2" />
260
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
261
+      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
262
+      <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
263
+      <window_info anchor="bottom" id="TODO" order="6" />
264
+      <window_info anchor="bottom" id="Database Changes" order="7" show_stripe_button="false" />
265
+      <window_info anchor="bottom" id="Terminal" order="8" />
266
+      <window_info anchor="bottom" id="Event Log" order="9" side_tool="true" />
267
+      <window_info anchor="bottom" id="Version Control" order="10" show_stripe_button="false" />
268
+      <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
269
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
270
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
271
+      <window_info anchor="right" id="Palette" order="3" />
272
+      <window_info anchor="right" id="Capture Analysis" order="4" />
273
+      <window_info anchor="right" id="Theme Preview" order="5" />
274
+      <window_info anchor="right" id="Palette&#9;" order="6" />
275
+      <window_info anchor="right" id="Database" order="7" />
276
+      <window_info anchor="right" id="Maven Projects" order="8" />
277
+    </layout>
278
+  </component>
279
+  <component name="TypeScriptGeneratedFilesManager">
280
+    <option name="version" value="1" />
281
+  </component>
282
+  <component name="VcsContentAnnotationSettings">
283
+    <option name="myLimit" value="2678400000" />
284
+  </component>
285
+  <component name="editorHistoryManager">
286
+    <entry file="file://$PROJECT_DIR$/main/java/rocks/zipcode/calcskin/CalcSkin.java">
287
+      <provider selected="true" editor-type-id="text-editor">
288
+        <state relative-caret-position="471">
289
+          <caret line="198" column="13" lean-forward="true" selection-start-line="198" selection-start-column="13" selection-end-line="198" selection-end-column="13" />
290
+        </state>
291
+      </provider>
292
+    </entry>
293
+    <entry file="file://$PROJECT_DIR$/main/java/rocks/zipcode/calcskin/MainApplication.java">
294
+      <provider selected="true" editor-type-id="text-editor">
295
+        <state relative-caret-position="75">
296
+          <caret line="5" selection-start-line="5" selection-end-line="5" />
297
+        </state>
298
+      </provider>
299
+    </entry>
300
+    <entry file="file://$PROJECT_DIR$/main/java/rocks/zipcode/calcskin/CalcEngine.java">
301
+      <provider selected="true" editor-type-id="text-editor">
302
+        <state relative-caret-position="443">
303
+          <caret line="43" column="8" selection-start-line="43" selection-start-column="8" selection-end-line="43" selection-end-column="8" />
304
+        </state>
305
+      </provider>
306
+    </entry>
307
+    <entry file="file://$PROJECT_DIR$/test/java/rocks/zipcode/calcskin/CalcEngineTest.java">
308
+      <provider selected="true" editor-type-id="text-editor">
309
+        <state relative-caret-position="165">
310
+          <caret line="11" lean-forward="true" selection-start-line="11" selection-end-line="11" />
311
+          <folding>
312
+            <element signature="imports" expanded="true" />
313
+          </folding>
314
+        </state>
315
+      </provider>
316
+    </entry>
317
+  </component>
318
+  <component name="masterDetails">
319
+    <states>
320
+      <state key="GlobalLibrariesConfigurable.UI">
321
+        <settings>
322
+          <splitter-proportions>
323
+            <option name="proportions">
324
+              <list>
325
+                <option value="0.2" />
326
+              </list>
327
+            </option>
328
+          </splitter-proportions>
329
+        </settings>
330
+      </state>
331
+      <state key="JdkListConfigurable.UI">
332
+        <settings>
333
+          <last-edited>1.8</last-edited>
334
+          <splitter-proportions>
335
+            <option name="proportions">
336
+              <list>
337
+                <option value="0.2" />
338
+              </list>
339
+            </option>
340
+          </splitter-proportions>
341
+        </settings>
342
+      </state>
343
+      <state key="ProjectJDKs.UI">
344
+        <settings>
345
+          <last-edited>1.8</last-edited>
346
+          <splitter-proportions>
347
+            <option name="proportions">
348
+              <list>
349
+                <option value="0.2" />
350
+              </list>
351
+            </option>
352
+          </splitter-proportions>
353
+        </settings>
354
+      </state>
355
+      <state key="ProjectLibrariesConfigurable.UI">
356
+        <settings>
357
+          <splitter-proportions>
358
+            <option name="proportions">
359
+              <list>
360
+                <option value="0.2" />
361
+              </list>
362
+            </option>
363
+          </splitter-proportions>
364
+        </settings>
365
+      </state>
366
+    </states>
367
+  </component>
368
+</project>

BIN
src/main/.DS_Store Voir le fichier


BIN
src/main/java/.DS_Store Voir le fichier


BIN
src/main/java/rocks/.DS_Store Voir le fichier


BIN
src/main/java/rocks/zipcode/.DS_Store Voir le fichier


+ 30
- 4
src/main/java/rocks/zipcode/calcskin/CalcEngine.java Voir le fichier

@@ -6,18 +6,44 @@ public class CalcEngine {
6 6
     }
7 7
 
8 8
     public double add(double v, double v1) {
9
-        return Double.NaN;
9
+
10
+        return (v + v1);
10 11
     }
11 12
 
12 13
     public double subtract(double v, double v1) {
13
-        return Double.NaN;
14
+
15
+        return (v - v1);
14 16
     }
15 17
 
16 18
     public double multiply(double v, double v1) {
17
-        return Double.NaN;
19
+
20
+        return (v * v1);
18 21
     }
19 22
 
20 23
     public double divide(double v, double v1) {
21
-        return Double.NaN;
24
+
25
+        return (v / v1);
26
+    }
27
+
28
+    public double square(double x){
29
+
30
+        return Math.pow(x,2);
31
+    }
32
+
33
+    public double sqrroot (double x){
34
+
35
+        return Math.sqrt(x);
36
+    }
37
+
38
+    public double exponent(double x, double y){
39
+        return Math.pow(x,y);
22 40
     }
41
+
42
+    public double invert(double x){
43
+
44
+        return (1/x);
45
+    }
46
+
23 47
 }
48
+
49
+

+ 19
- 9
src/main/java/rocks/zipcode/calcskin/CalcSkin.java Voir le fichier

@@ -24,10 +24,11 @@ public class CalcSkin extends Application {
24 24
         launch(args);
25 25
     }
26 26
     private static final String[][] template = {
27
-            { "7", "8", "9", "/" },
28
-            { "4", "5", "6", "*" },
29
-            { "1", "2", "3", "-" },
30
-            { "0", "c", "=", "+" }
27
+            { "7", "8", "9", "/", "S" },
28
+            { "4", "5", "6", "*", "SR" },
29
+            { "1", "2", "3", "-", "INV" },
30
+            { "0", "c", "=", "+", "EXP" }
31
+
31 32
     };
32 33
 
33 34
     private final Map<String, Button> accelerators = new HashMap<>();
@@ -36,7 +37,7 @@ public class CalcSkin extends Application {
36 37
     private DoubleProperty currentValue = new SimpleDoubleProperty();
37 38
     private CalcEngine calcEngine = new CalcEngine();
38 39
 
39
-    private enum Op { NOOP, ADD, SUBTRACT, MULTIPLY, DIVIDE }
40
+    private enum Op { NOOP, ADD, SUBTRACT, MULTIPLY, DIVIDE, EXPONENT, SQUARE, SQRROOT, INVERT}
40 41
 
41 42
     private Op curOp   = Op.NOOP;
42 43
     private Op stackOp = Op.NOOP;
@@ -51,16 +52,16 @@ public class CalcSkin extends Application {
51 52
         final TilePane  buttons = createButtons();
52 53
 
53 54
         stage.setTitle("Calc");
54
-        stage.initStyle(StageStyle.UTILITY);
55
+        stage.initStyle(StageStyle.DECORATED);
55 56
         stage.setResizable(false);
56 57
         stage.setScene(new Scene(createLayout(screen, buttons)));
57 58
         stage.show();
58 59
     }
59 60
 
60 61
     private VBox createLayout(TextField screen, TilePane buttons) {
61
-        final VBox layout = new VBox(20);
62
+        final VBox layout = new VBox(80);
62 63
         layout.setAlignment(Pos.CENTER);
63
-        layout.setStyle("-fx-background-color: silver; -fx-padding: 20; -fx-font-size: 20;");
64
+        layout.setStyle("-fx-background-color: Orange; -fx-padding: 40; -fx-font-size: 40;");
64 65
         layout.getChildren().setAll(screen, buttons);
65 66
         handleAccelerators(layout);
66 67
         screen.prefWidthProperty().bind(buttons.widthProperty());
@@ -81,7 +82,7 @@ public class CalcSkin extends Application {
81 82
 
82 83
     private TextField createScreen() {
83 84
         final TextField screen = new TextField();
84
-        screen.setStyle("-fx-background-color: aquamarine;");
85
+        screen.setStyle("-fx-background-color: White;");
85 86
         screen.setAlignment(Pos.CENTER_RIGHT);
86 87
         screen.setEditable(false);
87 88
         screen.textProperty().bind(Bindings.format("%.0f", currentValue));
@@ -127,6 +128,10 @@ public class CalcSkin extends Application {
127 128
             case "-": triggerOp.set(Op.SUBTRACT); break;
128 129
             case "*": triggerOp.set(Op.MULTIPLY); break;
129 130
             case "/": triggerOp.set(Op.DIVIDE);   break;
131
+            case "S": triggerOp.set(Op.SQUARE);   break;
132
+            case "SR" : triggerOp.set(Op.SQRROOT); break;
133
+            case "EXP" : triggerOp.set(Op.EXPONENT); break;
134
+            case "INV" : triggerOp.set(Op.INVERT);  break;
130 135
         }
131 136
         return triggerOp;
132 137
     }
@@ -185,6 +190,11 @@ public class CalcSkin extends Application {
185 190
                     case SUBTRACT: currentValue.set(calcEngine.subtract(previousValue.get(), currentValue.get())); break;
186 191
                     case MULTIPLY: currentValue.set(calcEngine.multiply(previousValue.get(), currentValue.get())); break;
187 192
                     case DIVIDE:   currentValue.set(calcEngine.divide(previousValue.get(), currentValue.get())); break;
193
+                    case SQUARE:   currentValue.set(calcEngine.square(previousValue.get())); break;
194
+                    case SQRROOT:   currentValue.set(calcEngine.sqrroot(previousValue.get())); break;
195
+                    case EXPONENT:   currentValue.set(calcEngine.exponent(previousValue.get(), currentValue.get())); break;
196
+                    case INVERT:   currentValue.set(calcEngine.invert(previousValue.get())); break;
197
+
188 198
                 }
189 199
             }
190 200
         });

+ 1
- 0
src/test/java/rocks/zipcode/calcskin/CalcEngineTest.java Voir le fichier

@@ -38,4 +38,5 @@ public class CalcEngineTest {
38 38
     public void divide() {
39 39
         Assert.assertTrue("", (testCalc.divide(10.0, 2.0) == 5.0));
40 40
     }
41
+
41 42
 }