Seth 6 年之前
父節點
當前提交
33d8195416
共有 3 個文件被更改,包括 82 次插入56 次删除
  1. 57
    56
      .idea/workspace.xml
  2. 13
    0
      arraz/src/main/java/Arraz.java
  3. 12
    0
      arraz/src/test/java/ArrazTest.java

+ 57
- 56
.idea/workspace.xml 查看文件

@@ -2,7 +2,6 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="3455511b-a100-4bbd-b07c-68f009bc8dbc" name="Default" comment="">
5
-      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
6 5
       <change beforePath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" afterDir="false" />
7 6
       <change beforePath="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" afterDir="false" />
8 7
     </list>
@@ -23,7 +22,7 @@
23 22
       </usages-collector>
24 23
       <usages-collector id="statistics.file.types.edit">
25 24
         <counts>
26
-          <entry key="JAVA" value="11042" />
25
+          <entry key="JAVA" value="11571" />
27 26
           <entry key="XML" value="3" />
28 27
         </counts>
29 28
       </usages-collector>
@@ -39,22 +38,10 @@
39 38
   <component name="FileEditorManager">
40 39
     <leaf SIDE_TABS_SIZE_LIMIT_KEY="375">
41 40
       <file pinned="false" current-in-tab="false">
42
-        <entry file="file://$PROJECT_DIR$/README.md">
43
-          <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
44
-            <state split_layout="SPLIT">
45
-              <first_editor relative-caret-position="306">
46
-                <caret line="69" column="5" selection-start-line="69" selection-start-column="5" selection-end-line="69" selection-end-column="5" />
47
-              </first_editor>
48
-              <second_editor />
49
-            </state>
50
-          </provider>
51
-        </entry>
52
-      </file>
53
-      <file pinned="false" current-in-tab="true">
54 41
         <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
55 42
           <provider selected="true" editor-type-id="text-editor">
56
-            <state relative-caret-position="285">
57
-              <caret line="130" column="19" selection-start-line="130" selection-start-column="19" selection-end-line="130" selection-end-column="19" />
43
+            <state relative-caret-position="556">
44
+              <caret line="170" column="21" selection-start-line="170" selection-start-column="21" selection-end-line="170" selection-end-column="21" />
58 45
               <folding>
59 46
                 <element signature="e#3440#3441#0" expanded="true" />
60 47
                 <element signature="e#3482#3483#0" expanded="true" />
@@ -67,11 +54,11 @@
67 54
           </provider>
68 55
         </entry>
69 56
       </file>
70
-      <file pinned="false" current-in-tab="false">
57
+      <file pinned="false" current-in-tab="true">
71 58
         <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
72 59
           <provider selected="true" editor-type-id="text-editor">
73
-            <state relative-caret-position="253">
74
-              <caret line="256" column="72" selection-start-line="256" selection-start-column="72" selection-end-line="256" selection-end-column="72" />
60
+            <state relative-caret-position="533">
61
+              <caret line="363" column="63" selection-start-line="363" selection-start-column="63" selection-end-line="363" selection-end-column="63" />
75 62
               <folding>
76 63
                 <element signature="imports" expanded="true" />
77 64
               </folding>
@@ -80,6 +67,18 @@
80 67
         </entry>
81 68
       </file>
82 69
       <file pinned="false" current-in-tab="false">
70
+        <entry file="file://$PROJECT_DIR$/README.md">
71
+          <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
72
+            <state split_layout="SPLIT">
73
+              <first_editor relative-caret-position="306">
74
+                <caret line="69" column="5" selection-start-line="69" selection-start-column="5" selection-end-line="69" selection-end-column="5" />
75
+              </first_editor>
76
+              <second_editor />
77
+            </state>
78
+          </provider>
79
+        </entry>
80
+      </file>
81
+      <file pinned="false" current-in-tab="false">
83 82
         <entry file="file://$PROJECT_DIR$/arraz/src/main/java/OddEven.java">
84 83
           <provider selected="true" editor-type-id="text-editor">
85 84
             <state>
@@ -220,7 +219,7 @@
220 219
     <property name="GO_FMT" value="false" />
221 220
     <property name="WebServerToolWindowFactoryState" value="false" />
222 221
     <property name="aspect.path.notification.shown" value="true" />
223
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544205690510" />
222
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544206709239" />
224 223
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
225 224
     <property name="jdk.selected.JAVA_MODULE" value="1.8" />
226 225
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
@@ -250,7 +249,7 @@
250 249
       </list>
251 250
     </option>
252 251
   </component>
253
-  <component name="RunManager" selected="JUnit.ArrazTest.testFind2ndLargestFromArray1">
252
+  <component name="RunManager" selected="JUnit.ArrazTest.testTheTotalOfTenIs302">
254 253
     <configuration default="true" type="Applet" factoryName="Applet">
255 254
       <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
256 255
       <method v="2">
@@ -263,53 +262,55 @@
263 262
         <option name="Make" enabled="true" />
264 263
       </method>
265 264
     </configuration>
266
-    <configuration name="ArrazTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
265
+    <configuration name="ArrazTest.testArrayHas65and772" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
267 266
       <module name="arraz" />
268 267
       <option name="PACKAGE_NAME" value="" />
269 268
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
269
+      <option name="METHOD_NAME" value="testArrayHas65and772" />
270
+      <option name="TEST_OBJECT" value="method" />
270 271
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
271 272
       <method v="2">
272 273
         <option name="Make" enabled="true" />
273 274
       </method>
274 275
     </configuration>
275
-    <configuration name="ArrazTest.testArrayHas65and771" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
276
+    <configuration name="ArrazTest.testFind2ndLargestFromArray1" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
276 277
       <module name="arraz" />
277 278
       <option name="PACKAGE_NAME" value="" />
278 279
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
279
-      <option name="METHOD_NAME" value="testArrayHas65and771" />
280
+      <option name="METHOD_NAME" value="testFind2ndLargestFromArray1" />
280 281
       <option name="TEST_OBJECT" value="method" />
281 282
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
282 283
       <method v="2">
283 284
         <option name="Make" enabled="true" />
284 285
       </method>
285 286
     </configuration>
286
-    <configuration name="ArrazTest.testArrayHas65and772" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
287
+    <configuration name="ArrazTest.testFind2ndLargestFromArray2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
287 288
       <module name="arraz" />
288 289
       <option name="PACKAGE_NAME" value="" />
289 290
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
290
-      <option name="METHOD_NAME" value="testArrayHas65and772" />
291
+      <option name="METHOD_NAME" value="testFind2ndLargestFromArray2" />
291 292
       <option name="TEST_OBJECT" value="method" />
292 293
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
293 294
       <method v="2">
294 295
         <option name="Make" enabled="true" />
295 296
       </method>
296 297
     </configuration>
297
-    <configuration name="ArrazTest.testFind2ndLargestFromArray1" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
298
+    <configuration name="ArrazTest.testTheTotalOfTenIs301" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
298 299
       <module name="arraz" />
299 300
       <option name="PACKAGE_NAME" value="" />
300 301
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
301
-      <option name="METHOD_NAME" value="testFind2ndLargestFromArray1" />
302
+      <option name="METHOD_NAME" value="testTheTotalOfTenIs301" />
302 303
       <option name="TEST_OBJECT" value="method" />
303 304
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
304 305
       <method v="2">
305 306
         <option name="Make" enabled="true" />
306 307
       </method>
307 308
     </configuration>
308
-    <configuration name="ArrazTest.testFind2ndLargestFromArray2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
309
+    <configuration name="ArrazTest.testTheTotalOfTenIs302" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
309 310
       <module name="arraz" />
310 311
       <option name="PACKAGE_NAME" value="" />
311 312
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
312
-      <option name="METHOD_NAME" value="testFind2ndLargestFromArray2" />
313
+      <option name="METHOD_NAME" value="testTheTotalOfTenIs302" />
313 314
       <option name="TEST_OBJECT" value="method" />
314 315
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
315 316
       <method v="2">
@@ -340,19 +341,19 @@
340 341
       </method>
341 342
     </configuration>
342 343
     <list>
343
-      <item itemvalue="JUnit.ArrazTest" />
344
-      <item itemvalue="JUnit.ArrazTest.testArrayHas65and771" />
345 344
       <item itemvalue="JUnit.ArrazTest.testArrayHas65and772" />
346 345
       <item itemvalue="JUnit.ArrazTest.testFind2ndLargestFromArray2" />
347 346
       <item itemvalue="JUnit.ArrazTest.testFind2ndLargestFromArray1" />
347
+      <item itemvalue="JUnit.ArrazTest.testTheTotalOfTenIs301" />
348
+      <item itemvalue="JUnit.ArrazTest.testTheTotalOfTenIs302" />
348 349
     </list>
349 350
     <recent_temporary>
350 351
       <list>
352
+        <item itemvalue="JUnit.ArrazTest.testTheTotalOfTenIs302" />
353
+        <item itemvalue="JUnit.ArrazTest.testTheTotalOfTenIs301" />
351 354
         <item itemvalue="JUnit.ArrazTest.testFind2ndLargestFromArray1" />
352 355
         <item itemvalue="JUnit.ArrazTest.testFind2ndLargestFromArray2" />
353 356
         <item itemvalue="JUnit.ArrazTest.testArrayHas65and772" />
354
-        <item itemvalue="JUnit.ArrazTest.testArrayHas65and771" />
355
-        <item itemvalue="JUnit.ArrazTest" />
356 357
       </list>
357 358
     </recent_temporary>
358 359
   </component>
@@ -369,7 +370,7 @@
369 370
       <workItem from="1543955862749" duration="2347000" />
370 371
       <workItem from="1543958998826" duration="113000" />
371 372
       <workItem from="1544020724645" duration="762000" />
372
-      <workItem from="1544046933389" duration="34996000" />
373
+      <workItem from="1544046933389" duration="36119000" />
373 374
     </task>
374 375
     <task id="LOCAL-00001" summary="readme and docs">
375 376
       <created>1544021313039</created>
@@ -382,12 +383,6 @@
382 383
     <servers />
383 384
   </component>
384 385
   <component name="TestHistory">
385
-    <history-entry file="ArrazTest_testArrayHas65and771 - 2018.12.07 at 10h 54m 19s.xml">
386
-      <configuration name="ArrazTest.testArrayHas65and771" configurationId="JUnit" />
387
-    </history-entry>
388
-    <history-entry file="ArrazTest_testArrayHas65and772 - 2018.12.07 at 10h 54m 23s.xml">
389
-      <configuration name="ArrazTest.testArrayHas65and772" configurationId="JUnit" />
390
-    </history-entry>
391 386
     <history-entry file="ArrazTest_testAverageArrayWithoutMaxMin2 - 2018.12.07 at 12h 43m 07s.xml">
392 387
       <configuration name="ArrazTest.testAverageArrayWithoutMaxMin2" configurationId="JUnit" />
393 388
     </history-entry>
@@ -412,15 +407,21 @@
412 407
     <history-entry file="ArrazTest_testArrayHas65and772 - 2018.12.07 at 12h 52m 03s.xml">
413 408
       <configuration name="ArrazTest.testArrayHas65and772" configurationId="JUnit" />
414 409
     </history-entry>
410
+    <history-entry file="ArrazTest_testFind2ndLargestFromArray2 - 2018.12.07 at 13h 01m 28s.xml">
411
+      <configuration name="ArrazTest.testFind2ndLargestFromArray2" configurationId="JUnit" />
412
+    </history-entry>
413
+    <history-entry file="ArrazTest_testFind2ndLargestFromArray1 - 2018.12.07 at 13h 01m 31s.xml">
414
+      <configuration name="ArrazTest.testFind2ndLargestFromArray1" configurationId="JUnit" />
415
+    </history-entry>
415 416
   </component>
416 417
   <component name="TimeTrackingManager">
417
-    <option name="totallyTimeSpent" value="38218000" />
418
+    <option name="totallyTimeSpent" value="39341000" />
418 419
   </component>
419 420
   <component name="ToolWindowManager">
420 421
     <frame x="1" y="23" width="1440" height="807" extended-state="0" />
421 422
     <editor active="true" />
422 423
     <layout>
423
-      <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.26108727" />
424
+      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.26108727" />
424 425
       <window_info id="Structure" order="1" weight="0.25" />
425 426
       <window_info id="Image Layers" order="2" />
426 427
       <window_info id="Designer" order="3" />
@@ -431,7 +432,7 @@
431 432
       <window_info anchor="bottom" id="Messages" weight="0.32867134" />
432 433
       <window_info anchor="bottom" id="Message" order="0" />
433 434
       <window_info anchor="bottom" id="Find" order="1" />
434
-      <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.32867134" />
435
+      <window_info anchor="bottom" id="Run" order="2" weight="0.32867134" />
435 436
       <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
436 437
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
437 438
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
@@ -552,20 +553,10 @@
552 553
         </state>
553 554
       </provider>
554 555
     </entry>
555
-    <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
556
-      <provider selected="true" editor-type-id="text-editor">
557
-        <state relative-caret-position="253">
558
-          <caret line="256" column="72" selection-start-line="256" selection-start-column="72" selection-end-line="256" selection-end-column="72" />
559
-          <folding>
560
-            <element signature="imports" expanded="true" />
561
-          </folding>
562
-        </state>
563
-      </provider>
564
-    </entry>
565 556
     <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
566 557
       <provider selected="true" editor-type-id="text-editor">
567
-        <state relative-caret-position="285">
568
-          <caret line="130" column="19" selection-start-line="130" selection-start-column="19" selection-end-line="130" selection-end-column="19" />
558
+        <state relative-caret-position="556">
559
+          <caret line="170" column="21" selection-start-line="170" selection-start-column="21" selection-end-line="170" selection-end-column="21" />
569 560
           <folding>
570 561
             <element signature="e#3440#3441#0" expanded="true" />
571 562
             <element signature="e#3482#3483#0" expanded="true" />
@@ -577,6 +568,16 @@
577 568
         </state>
578 569
       </provider>
579 570
     </entry>
571
+    <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
572
+      <provider selected="true" editor-type-id="text-editor">
573
+        <state relative-caret-position="533">
574
+          <caret line="363" column="63" selection-start-line="363" selection-start-column="63" selection-end-line="363" selection-end-column="63" />
575
+          <folding>
576
+            <element signature="imports" expanded="true" />
577
+          </folding>
578
+        </state>
579
+      </provider>
580
+    </entry>
580 581
   </component>
581 582
   <component name="masterDetails">
582 583
     <states>

+ 13
- 0
arraz/src/main/java/Arraz.java 查看文件

@@ -157,4 +157,17 @@ public class Arraz {
157 157
                 return true;
158 158
             }else{return false;}
159 159
     }
160
+
161
+    public boolean theTotalOfTenIs30(Integer[] array){
162
+        int sum10 = 0;
163
+        for (Integer each:array){
164
+            if(each == 10){
165
+                sum10 += each;
166
+                if(sum10 == 30){
167
+                    return true;
168
+                }
169
+            }
170
+        }
171
+        return false;
172
+    }
160 173
 }

+ 12
- 0
arraz/src/test/java/ArrazTest.java 查看文件

@@ -352,4 +352,16 @@ public class ArrazTest {
352 352
         Assert.assertFalse(testArraz.arrayHas65and77(array));
353 353
     }
354 354
 
355
+    @Test
356
+    public void testTheTotalOfTenIs301() {
357
+        Integer[] array = new Integer[]{10, 4, 3, 10, 56, 10};
358
+        Assert.assertTrue(testArraz.theTotalOfTenIs30(array));
359
+    }
360
+
361
+    @Test
362
+    public void testTheTotalOfTenIs302(){
363
+        Integer[] array = new Integer[]{10, 98, 2, 34,10};
364
+        Assert.assertFalse(testArraz.theTotalOfTenIs30(array));
365
+    }
366
+
355 367
 }