mpierse преди 6 години
родител
ревизия
1a94e4dd84
променени са 3 файла, в които са добавени 418 реда и са изтрити 68 реда
  1. 92
    56
      .idea/workspace.xml
  2. 104
    5
      arraz/src/main/java/Arraz.java
  3. 222
    7
      arraz/src/test/java/ArrazTest.java

+ 92
- 56
.idea/workspace.xml Целия файл

2
 <project version="4">
2
 <project version="4">
3
   <component name="ChangeListManager">
3
   <component name="ChangeListManager">
4
     <list default="true" id="3455511b-a100-4bbd-b07c-68f009bc8dbc" name="Default" comment="">
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" />
5
       <change beforePath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" afterDir="false" />
6
       <change beforePath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/main/java/Arraz.java" afterDir="false" />
7
+      <change beforePath="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java" afterDir="false" />
6
     </list>
8
     </list>
7
     <ignored path="$PROJECT_DIR$/arraz/target/" />
9
     <ignored path="$PROJECT_DIR$/arraz/target/" />
8
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
10
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
33
       </usages-collector>
35
       </usages-collector>
34
       <usages-collector id="statistics.file.extensions.edit">
36
       <usages-collector id="statistics.file.extensions.edit">
35
         <counts>
37
         <counts>
36
-          <entry key="java" value="3614" />
38
+          <entry key="java" value="6017" />
37
         </counts>
39
         </counts>
38
       </usages-collector>
40
       </usages-collector>
39
       <usages-collector id="statistics.file.types.edit">
41
       <usages-collector id="statistics.file.types.edit">
40
         <counts>
42
         <counts>
41
-          <entry key="JAVA" value="3614" />
43
+          <entry key="JAVA" value="6017" />
42
         </counts>
44
         </counts>
43
       </usages-collector>
45
       </usages-collector>
44
     </session>
46
     </session>
55
           <file pinned="false" current-in-tab="false">
57
           <file pinned="false" current-in-tab="false">
56
             <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
58
             <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
57
               <provider selected="true" editor-type-id="text-editor">
59
               <provider selected="true" editor-type-id="text-editor">
58
-                <state relative-caret-position="354">
59
-                  <caret line="119" column="22" selection-start-line="119" selection-start-column="22" selection-end-line="119" selection-end-column="22" />
60
+                <state relative-caret-position="308">
61
+                  <caret line="223" column="5" lean-forward="true" selection-start-line="223" selection-start-column="5" selection-end-line="223" selection-end-column="5" />
60
                   <folding>
62
                   <folding>
61
                     <element signature="imports" expanded="true" />
63
                     <element signature="imports" expanded="true" />
62
                     <element signature="e#414#415#0" expanded="true" />
64
                     <element signature="e#414#415#0" expanded="true" />
64
                     <element signature="e#535#536#0" expanded="true" />
66
                     <element signature="e#535#536#0" expanded="true" />
65
                     <element signature="e#576#577#0" expanded="true" />
67
                     <element signature="e#576#577#0" expanded="true" />
66
                     <element signature="e#2895#2904#0" expanded="true" />
68
                     <element signature="e#2895#2904#0" expanded="true" />
69
+                    <element signature="e#3350#3359#0" expanded="true" />
70
+                    <element signature="e#4784#4785#0" expanded="true" />
71
+                    <element signature="e#4834#4835#0" expanded="true" />
72
+                    <element signature="e#4883#4884#0" expanded="true" />
73
+                    <element signature="e#4959#4960#0" expanded="true" />
74
+                    <element signature="e#5009#5010#0" expanded="true" />
75
+                    <element signature="e#5074#5075#0" expanded="true" />
76
+                    <element signature="e#5184#5185#0" expanded="true" />
77
+                    <element signature="e#5223#5224#0" expanded="true" />
78
+                    <element signature="e#5377#5378#0" expanded="true" />
79
+                    <element signature="e#5445#5446#0" expanded="true" />
80
+                    <element signature="e#5548#5557#0" expanded="true" />
81
+                    <element signature="e#5608#5617#0" expanded="true" />
67
                   </folding>
82
                   </folding>
68
                 </state>
83
                 </state>
69
               </provider>
84
               </provider>
72
           <file pinned="false" current-in-tab="true">
87
           <file pinned="false" current-in-tab="true">
73
             <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
88
             <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
74
               <provider selected="true" editor-type-id="text-editor">
89
               <provider selected="true" editor-type-id="text-editor">
75
-                <state relative-caret-position="309">
76
-                  <caret line="191" column="43" lean-forward="true" selection-start-line="191" selection-start-column="43" selection-end-line="191" selection-end-column="43" />
90
+                <state relative-caret-position="296">
91
+                  <caret line="406" lean-forward="true" selection-start-line="406" selection-end-line="406" />
77
                   <folding>
92
                   <folding>
78
                     <element signature="imports" expanded="true" />
93
                     <element signature="imports" expanded="true" />
79
                     <element signature="e#1970#1971#0" expanded="true" />
94
                     <element signature="e#1970#1971#0" expanded="true" />
86
                     <element signature="e#3348#3349#0" expanded="true" />
101
                     <element signature="e#3348#3349#0" expanded="true" />
87
                     <element signature="e#5073#5074#0" expanded="true" />
102
                     <element signature="e#5073#5074#0" expanded="true" />
88
                     <element signature="e#5149#5150#0" expanded="true" />
103
                     <element signature="e#5149#5150#0" expanded="true" />
104
+                    <element signature="e#6908#6917#0" expanded="true" />
105
+                    <element signature="e#7319#7328#0" expanded="true" />
89
                   </folding>
106
                   </folding>
90
                 </state>
107
                 </state>
91
               </provider>
108
               </provider>
148
       </list>
165
       </list>
149
     </option>
166
     </option>
150
   </component>
167
   </component>
168
+  <component name="FindInProjectRecents">
169
+    <findStrings>
170
+      <find>che</find>
171
+      <find>rever</find>
172
+    </findStrings>
173
+  </component>
151
   <component name="Git.Settings">
174
   <component name="Git.Settings">
152
     <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
175
     <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
153
   </component>
176
   </component>
235
     <property name="GO_FMT" value="false" />
258
     <property name="GO_FMT" value="false" />
236
     <property name="WebServerToolWindowFactoryState" value="false" />
259
     <property name="WebServerToolWindowFactoryState" value="false" />
237
     <property name="aspect.path.notification.shown" value="true" />
260
     <property name="aspect.path.notification.shown" value="true" />
238
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544142316149" />
261
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544204129622" />
239
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
262
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
240
     <property name="jdk.selected.JAVA_MODULE" value="1.8" />
263
     <property name="jdk.selected.JAVA_MODULE" value="1.8" />
241
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
264
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
265
       </list>
288
       </list>
266
     </option>
289
     </option>
267
   </component>
290
   </component>
268
-  <component name="RunManager" selected="JUnit.ArrazTest.test2RemoveDupes">
291
+  <component name="RunManager" selected="JUnit.ArrazTest">
269
     <configuration default="true" type="Applet" factoryName="Applet">
292
     <configuration default="true" type="Applet" factoryName="Applet">
270
       <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
293
       <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
271
       <method v="2">
294
       <method v="2">
278
         <option name="Make" enabled="true" />
301
         <option name="Make" enabled="true" />
279
       </method>
302
       </method>
280
     </configuration>
303
     </configuration>
281
-    <configuration name="ArrazTest.test1FindMinMax" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
304
+    <configuration name="ArrazTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
282
       <module name="arraz" />
305
       <module name="arraz" />
283
       <option name="PACKAGE_NAME" value="" />
306
       <option name="PACKAGE_NAME" value="" />
284
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
307
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
285
-      <option name="METHOD_NAME" value="test1FindMinMax" />
286
-      <option name="TEST_OBJECT" value="method" />
287
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
308
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
288
       <method v="2">
309
       <method v="2">
289
         <option name="Make" enabled="true" />
310
         <option name="Make" enabled="true" />
290
       </method>
311
       </method>
291
     </configuration>
312
     </configuration>
292
-    <configuration name="ArrazTest.test1RemoveDupes" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
313
+    <configuration name="ArrazTest.test1SortArrayEvenOdd" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
293
       <module name="arraz" />
314
       <module name="arraz" />
294
       <option name="PACKAGE_NAME" value="" />
315
       <option name="PACKAGE_NAME" value="" />
295
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
316
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
296
-      <option name="METHOD_NAME" value="test1RemoveDupes" />
317
+      <option name="METHOD_NAME" value="test1SortArrayEvenOdd" />
297
       <option name="TEST_OBJECT" value="method" />
318
       <option name="TEST_OBJECT" value="method" />
298
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
319
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
299
       <method v="2">
320
       <method v="2">
300
         <option name="Make" enabled="true" />
321
         <option name="Make" enabled="true" />
301
       </method>
322
       </method>
302
     </configuration>
323
     </configuration>
303
-    <configuration name="ArrazTest.test2FindMinMax" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
324
+    <configuration name="ArrazTest.test1insertEndAndCopy" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
304
       <module name="arraz" />
325
       <module name="arraz" />
305
       <option name="PACKAGE_NAME" value="" />
326
       <option name="PACKAGE_NAME" value="" />
306
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
327
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
307
-      <option name="METHOD_NAME" value="test2FindMinMax" />
328
+      <option name="METHOD_NAME" value="test1insertEndAndCopy" />
308
       <option name="TEST_OBJECT" value="method" />
329
       <option name="TEST_OBJECT" value="method" />
309
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
330
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
310
       <method v="2">
331
       <method v="2">
311
         <option name="Make" enabled="true" />
332
         <option name="Make" enabled="true" />
312
       </method>
333
       </method>
313
     </configuration>
334
     </configuration>
314
-    <configuration name="ArrazTest.test2InsertIntoArrayAt" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
335
+    <configuration name="ArrazTest.test2SortArrayEvenOdd" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
315
       <module name="arraz" />
336
       <module name="arraz" />
316
       <option name="PACKAGE_NAME" value="" />
337
       <option name="PACKAGE_NAME" value="" />
317
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
338
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
318
-      <option name="METHOD_NAME" value="test2InsertIntoArrayAt" />
339
+      <option name="METHOD_NAME" value="test2SortArrayEvenOdd" />
319
       <option name="TEST_OBJECT" value="method" />
340
       <option name="TEST_OBJECT" value="method" />
320
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
341
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
321
       <method v="2">
342
       <method v="2">
322
         <option name="Make" enabled="true" />
343
         <option name="Make" enabled="true" />
323
       </method>
344
       </method>
324
     </configuration>
345
     </configuration>
325
-    <configuration name="ArrazTest.test2RemoveDupes" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
346
+    <configuration name="ArrazTest.test2insertEndAndCopy" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
326
       <module name="arraz" />
347
       <module name="arraz" />
327
       <option name="PACKAGE_NAME" value="" />
348
       <option name="PACKAGE_NAME" value="" />
328
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
349
       <option name="MAIN_CLASS_NAME" value="ArrazTest" />
329
-      <option name="METHOD_NAME" value="test2RemoveDupes" />
350
+      <option name="METHOD_NAME" value="test2insertEndAndCopy" />
330
       <option name="TEST_OBJECT" value="method" />
351
       <option name="TEST_OBJECT" value="method" />
331
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
352
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
332
       <method v="2">
353
       <method v="2">
357
       </method>
378
       </method>
358
     </configuration>
379
     </configuration>
359
     <list>
380
     <list>
360
-      <item itemvalue="JUnit.ArrazTest.test2InsertIntoArrayAt" />
361
-      <item itemvalue="JUnit.ArrazTest.test1FindMinMax" />
362
-      <item itemvalue="JUnit.ArrazTest.test2FindMinMax" />
363
-      <item itemvalue="JUnit.ArrazTest.test1RemoveDupes" />
364
-      <item itemvalue="JUnit.ArrazTest.test2RemoveDupes" />
381
+      <item itemvalue="JUnit.ArrazTest.test1insertEndAndCopy" />
382
+      <item itemvalue="JUnit.ArrazTest.test2insertEndAndCopy" />
383
+      <item itemvalue="JUnit.ArrazTest.test1SortArrayEvenOdd" />
384
+      <item itemvalue="JUnit.ArrazTest.test2SortArrayEvenOdd" />
385
+      <item itemvalue="JUnit.ArrazTest" />
365
     </list>
386
     </list>
366
     <recent_temporary>
387
     <recent_temporary>
367
       <list>
388
       <list>
368
-        <item itemvalue="JUnit.ArrazTest.test2RemoveDupes" />
369
-        <item itemvalue="JUnit.ArrazTest.test1RemoveDupes" />
370
-        <item itemvalue="JUnit.ArrazTest.test2FindMinMax" />
371
-        <item itemvalue="JUnit.ArrazTest.test1FindMinMax" />
372
-        <item itemvalue="JUnit.ArrazTest.test2InsertIntoArrayAt" />
389
+        <item itemvalue="JUnit.ArrazTest" />
390
+        <item itemvalue="JUnit.ArrazTest.test2SortArrayEvenOdd" />
391
+        <item itemvalue="JUnit.ArrazTest.test1SortArrayEvenOdd" />
392
+        <item itemvalue="JUnit.ArrazTest.test2insertEndAndCopy" />
393
+        <item itemvalue="JUnit.ArrazTest.test1insertEndAndCopy" />
373
       </list>
394
       </list>
374
     </recent_temporary>
395
     </recent_temporary>
375
   </component>
396
   </component>
386
       <workItem from="1543955862749" duration="2347000" />
407
       <workItem from="1543955862749" duration="2347000" />
387
       <workItem from="1543958998826" duration="113000" />
408
       <workItem from="1543958998826" duration="113000" />
388
       <workItem from="1544020724645" duration="762000" />
409
       <workItem from="1544020724645" duration="762000" />
389
-      <workItem from="1544046527795" duration="14260000" />
410
+      <workItem from="1544046527795" duration="26482000" />
390
     </task>
411
     </task>
391
     <task id="LOCAL-00001" summary="readme and docs">
412
     <task id="LOCAL-00001" summary="readme and docs">
392
       <created>1544021313039</created>
413
       <created>1544021313039</created>
399
     <servers />
420
     <servers />
400
   </component>
421
   </component>
401
   <component name="TestHistory">
422
   <component name="TestHistory">
402
-    <history-entry file="ArrazTest_test1InsertIntoArrayAt - 2018.12.06 at 18h 23m 24s.xml">
403
-      <configuration name="ArrazTest.test1InsertIntoArrayAt" configurationId="JUnit" />
404
-    </history-entry>
405
-    <history-entry file="ArrazTest_test2InsertIntoArrayAt - 2018.12.06 at 18h 23m 30s.xml">
423
+    <history-entry file="ArrazTest_test2InsertIntoArrayAt - 2018.12.07 at 12h 05m 05s.xml">
406
       <configuration name="ArrazTest.test2InsertIntoArrayAt" configurationId="JUnit" />
424
       <configuration name="ArrazTest.test2InsertIntoArrayAt" configurationId="JUnit" />
407
     </history-entry>
425
     </history-entry>
408
-    <history-entry file="ArrazTest_test2InsertIntoArrayAt - 2018.12.06 at 18h 23m 40s.xml">
409
-      <configuration name="ArrazTest.test2InsertIntoArrayAt" configurationId="JUnit" />
426
+    <history-entry file="ArrazTest_test1insertFirstAndCopy - 2018.12.07 at 12h 07m 39s.xml">
427
+      <configuration name="ArrazTest.test1insertFirstAndCopy" configurationId="JUnit" />
410
     </history-entry>
428
     </history-entry>
411
-    <history-entry file="ArrazTest_test2InsertIntoArrayAt - 2018.12.06 at 18h 23m 47s.xml">
412
-      <configuration name="ArrazTest.test2InsertIntoArrayAt" configurationId="JUnit" />
429
+    <history-entry file="ArrazTest_test1insertFirstAndCopy - 2018.12.07 at 12h 09m 16s.xml">
430
+      <configuration name="ArrazTest.test1insertFirstAndCopy" configurationId="JUnit" />
431
+    </history-entry>
432
+    <history-entry file="ArrazTest_test1insertFirstAndCopy - 2018.12.07 at 12h 10m 08s.xml">
433
+      <configuration name="ArrazTest.test1insertFirstAndCopy" configurationId="JUnit" />
413
     </history-entry>
434
     </history-entry>
414
-    <history-entry file="ArrazTest_test1FindMinMax - 2018.12.06 at 18h 43m 10s.xml">
415
-      <configuration name="ArrazTest.test1FindMinMax" configurationId="JUnit" />
435
+    <history-entry file="ArrazTest_test2insertFirstAndCopy - 2018.12.07 at 12h 10m 11s.xml">
436
+      <configuration name="ArrazTest.test2insertFirstAndCopy" configurationId="JUnit" />
416
     </history-entry>
437
     </history-entry>
417
-    <history-entry file="ArrazTest_test1FindMinMax - 2018.12.06 at 18h 43m 43s.xml">
418
-      <configuration name="ArrazTest.test1FindMinMax" configurationId="JUnit" />
438
+    <history-entry file="ArrazTest_test2insertFirstAndCopy - 2018.12.07 at 12h 10m 35s.xml">
439
+      <configuration name="ArrazTest.test2insertFirstAndCopy" configurationId="JUnit" />
419
     </history-entry>
440
     </history-entry>
420
-    <history-entry file="ArrazTest_test2FindMinMax - 2018.12.06 at 18h 43m 45s.xml">
421
-      <configuration name="ArrazTest.test2FindMinMax" configurationId="JUnit" />
441
+    <history-entry file="ArrazTest_test1insertEndAndCopy - 2018.12.07 at 12h 12m 34s.xml">
442
+      <configuration name="ArrazTest.test1insertEndAndCopy" configurationId="JUnit" />
422
     </history-entry>
443
     </history-entry>
423
-    <history-entry file="ArrazTest_test1RemoveDupes - 2018.12.06 at 19h 04m 59s.xml">
424
-      <configuration name="ArrazTest.test1RemoveDupes" configurationId="JUnit" />
444
+    <history-entry file="ArrazTest_test1insertEndAndCopy - 2018.12.07 at 12h 12m 38s.xml">
445
+      <configuration name="ArrazTest.test1insertEndAndCopy" configurationId="JUnit" />
425
     </history-entry>
446
     </history-entry>
426
-    <history-entry file="ArrazTest_test2RemoveDupes - 2018.12.06 at 19h 05m 07s.xml">
427
-      <configuration name="ArrazTest.test2RemoveDupes" configurationId="JUnit" />
447
+    <history-entry file="ArrazTest_test1insertEndAndCopy - 2018.12.07 at 12h 12m 42s.xml">
448
+      <configuration name="ArrazTest.test1insertEndAndCopy" configurationId="JUnit" />
428
     </history-entry>
449
     </history-entry>
429
-    <history-entry file="ArrazTest_test1RemoveDupes - 2018.12.06 at 19h 06m 41s.xml">
430
-      <configuration name="ArrazTest.test1RemoveDupes" configurationId="JUnit" />
450
+    <history-entry file="ArrazTest_test2insertEndAndCopy - 2018.12.07 at 12h 12m 44s.xml">
451
+      <configuration name="ArrazTest.test2insertEndAndCopy" configurationId="JUnit" />
431
     </history-entry>
452
     </history-entry>
432
   </component>
453
   </component>
433
   <component name="TimeTrackingManager">
454
   <component name="TimeTrackingManager">
434
-    <option name="totallyTimeSpent" value="17482000" />
455
+    <option name="totallyTimeSpent" value="29704000" />
435
   </component>
456
   </component>
436
   <component name="ToolWindowManager">
457
   <component name="ToolWindowManager">
437
     <frame x="0" y="23" width="1440" height="805" extended-state="6" />
458
     <frame x="0" y="23" width="1440" height="805" extended-state="6" />
449
       <window_info anchor="bottom" id="Message" order="0" />
470
       <window_info anchor="bottom" id="Message" order="0" />
450
       <window_info anchor="bottom" id="Find" order="1" />
471
       <window_info anchor="bottom" id="Find" order="1" />
451
       <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.33239833" />
472
       <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.33239833" />
452
-      <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
473
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.3997195" />
453
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
474
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
454
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
475
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
455
       <window_info anchor="bottom" id="TODO" order="6" />
476
       <window_info anchor="bottom" id="TODO" order="6" />
518
     </entry>
539
     </entry>
519
     <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
540
     <entry file="file://$PROJECT_DIR$/arraz/src/main/java/Arraz.java">
520
       <provider selected="true" editor-type-id="text-editor">
541
       <provider selected="true" editor-type-id="text-editor">
521
-        <state relative-caret-position="354">
522
-          <caret line="119" column="22" selection-start-line="119" selection-start-column="22" selection-end-line="119" selection-end-column="22" />
542
+        <state relative-caret-position="308">
543
+          <caret line="223" column="5" lean-forward="true" selection-start-line="223" selection-start-column="5" selection-end-line="223" selection-end-column="5" />
523
           <folding>
544
           <folding>
524
             <element signature="imports" expanded="true" />
545
             <element signature="imports" expanded="true" />
525
             <element signature="e#414#415#0" expanded="true" />
546
             <element signature="e#414#415#0" expanded="true" />
527
             <element signature="e#535#536#0" expanded="true" />
548
             <element signature="e#535#536#0" expanded="true" />
528
             <element signature="e#576#577#0" expanded="true" />
549
             <element signature="e#576#577#0" expanded="true" />
529
             <element signature="e#2895#2904#0" expanded="true" />
550
             <element signature="e#2895#2904#0" expanded="true" />
551
+            <element signature="e#3350#3359#0" expanded="true" />
552
+            <element signature="e#4784#4785#0" expanded="true" />
553
+            <element signature="e#4834#4835#0" expanded="true" />
554
+            <element signature="e#4883#4884#0" expanded="true" />
555
+            <element signature="e#4959#4960#0" expanded="true" />
556
+            <element signature="e#5009#5010#0" expanded="true" />
557
+            <element signature="e#5074#5075#0" expanded="true" />
558
+            <element signature="e#5184#5185#0" expanded="true" />
559
+            <element signature="e#5223#5224#0" expanded="true" />
560
+            <element signature="e#5377#5378#0" expanded="true" />
561
+            <element signature="e#5445#5446#0" expanded="true" />
562
+            <element signature="e#5548#5557#0" expanded="true" />
563
+            <element signature="e#5608#5617#0" expanded="true" />
530
           </folding>
564
           </folding>
531
         </state>
565
         </state>
532
       </provider>
566
       </provider>
533
     </entry>
567
     </entry>
534
     <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
568
     <entry file="file://$PROJECT_DIR$/arraz/src/test/java/ArrazTest.java">
535
       <provider selected="true" editor-type-id="text-editor">
569
       <provider selected="true" editor-type-id="text-editor">
536
-        <state relative-caret-position="309">
537
-          <caret line="191" column="43" lean-forward="true" selection-start-line="191" selection-start-column="43" selection-end-line="191" selection-end-column="43" />
570
+        <state relative-caret-position="296">
571
+          <caret line="406" lean-forward="true" selection-start-line="406" selection-end-line="406" />
538
           <folding>
572
           <folding>
539
             <element signature="imports" expanded="true" />
573
             <element signature="imports" expanded="true" />
540
             <element signature="e#1970#1971#0" expanded="true" />
574
             <element signature="e#1970#1971#0" expanded="true" />
547
             <element signature="e#3348#3349#0" expanded="true" />
581
             <element signature="e#3348#3349#0" expanded="true" />
548
             <element signature="e#5073#5074#0" expanded="true" />
582
             <element signature="e#5073#5074#0" expanded="true" />
549
             <element signature="e#5149#5150#0" expanded="true" />
583
             <element signature="e#5149#5150#0" expanded="true" />
584
+            <element signature="e#6908#6917#0" expanded="true" />
585
+            <element signature="e#7319#7328#0" expanded="true" />
550
           </folding>
586
           </folding>
551
         </state>
587
         </state>
552
       </provider>
588
       </provider>

+ 104
- 5
arraz/src/main/java/Arraz.java Целия файл

37
     public int[] reverse(int[] arr) {
37
     public int[] reverse(int[] arr) {
38
         for(int i = 0; i<arr.length/2; i++){
38
         for(int i = 0; i<arr.length/2; i++){
39
            int temp = arr[i];
39
            int temp = arr[i];
40
-           arr[i]=arr[arr.length-1];
41
-           arr[arr.length-1-i]=temp;
40
+           arr[i]=arr[arr.length-i-1];
41
+           arr[arr.length-i-1]=temp;
42
         }
42
         }
43
         return arr;
43
         return arr;
44
     }
44
     }
83
     }
83
     }
84
 
84
 
85
     public int[] removeElement(int[] arr, int val) {
85
     public int[] removeElement(int[] arr, int val) {
86
-        int[] result = new int[arr.length];
86
+        int[] result = new int[arr.length-1];
87
+        int count =0;
87
         for(int i=0; i<arr.length; i++){
88
         for(int i=0; i<arr.length; i++){
88
-            if(arr[i]!=val)
89
-            result[i]=arr[i];
89
+            if(arr[i]!=val){
90
+            result[count]=arr[i];
91
+            count++;}
90
         }
92
         }
91
         return result;
93
         return result;
92
     }
94
     }
93
 
95
 
94
     public int[] insertIntoArrayAt(int[] arr, int val, int index) {
96
     public int[] insertIntoArrayAt(int[] arr, int val, int index) {
97
+       if (index> arr.length+1) throw new ArrayIndexOutOfBoundsException();
95
         int[] result = new int[arr.length+1];
98
         int[] result = new int[arr.length+1];
96
         int counter = 0;
99
         int counter = 0;
97
         for (int i = 0; i <result.length; i++) {
100
         for (int i = 0; i <result.length; i++) {
121
         }
124
         }
122
         return result;
125
         return result;
123
     }
126
     }
127
+
128
+    public int find2ndLargest(int[] arr) {
129
+        Arrays.sort(arr);
130
+        return arr[arr.length-2];
131
+    }
132
+
133
+    public ArrayList<Integer> makeArrayList(int[] arr) {
134
+        ArrayList<Integer> result = new ArrayList<Integer>();
135
+        for (int i : arr) {
136
+            result.add((Integer)i);
137
+        }
138
+        return result;
139
+    }
140
+
141
+    public int[] makeArray(ArrayList<Integer> list) {
142
+        int[] result = new int[list.size()];
143
+        for (int i = 0; i < list.size(); i++) {
144
+            result[i]=(int)list.get(i);
145
+        }
146
+        return result;
147
+    }
148
+
149
+    public boolean check2Arrays(int[] arr1, int[] arr2) {
150
+        if(arr1.length!=arr2.length) return false;
151
+        for (int i = 0; i < arr1.length; i++) {
152
+            if(arr1[i] != arr2[i]) return false;
153
+        }
154
+        return true;
155
+    }
156
+
157
+    public int averageWithoutMinMax(int[] arr) {
158
+        Arrays.sort(arr);
159
+        int result = 0;
160
+        for (int i = 1; i < arr.length-1; i++) {
161
+            result += arr[i];
162
+        }
163
+        return result/(arr.length-2);
164
+    }
165
+
166
+    public boolean has65and77(int[] testArr) {
167
+        boolean contains65 = false;
168
+        boolean contains77 = false;
169
+        for (int i: testArr) {
170
+            if (i ==65) contains65=true;
171
+            if (i==77) contains77=true;
172
+        }
173
+        return (contains65&&contains77);
174
+    }
175
+
176
+    public boolean toalOf10sIs30(int[] arr) {
177
+        int tenCount = 0;
178
+        for (int i : arr) {
179
+            if (i==10) tenCount++;
180
+        }
181
+        return (tenCount==3);
182
+    }
183
+
184
+    public int[] makeCopyReverse(int[] arr) {
185
+      return reverse(copyArrayByLoop(arr));
186
+    }
187
+
188
+    public int[] removeLastAndCopy(int[] arr) {
189
+        return copyArrayByLoop(removeElement(arr,arr[arr.length-1]));
190
+    }
191
+
192
+    public int[] removeFirstAndCopy(int[] arr) {
193
+        return copyArrayByLoop(removeElement(arr,arr[0]));
194
+    }
195
+
196
+    public int[] insertFirstAndCopy(int[] arr, int i) {
197
+        return copyArrayByLoop(insertIntoArrayAt(arr, i, 0));
198
+    }
199
+
200
+    public int[] insertEndAndCopy(int[] arr, int i) {
201
+        return copyArrayByLoop(insertIntoArrayAt(arr, i, arr.length));
202
+    }
203
+
204
+    public int[] sortArrayEvenOdd(int[] arr) {
205
+        ArrayList<Integer> evens = new ArrayList<Integer>();
206
+        ArrayList<Integer> odds = new ArrayList<Integer>();
207
+        int[] result = new int[arr.length];
208
+        int count = 0;
209
+        for (int i: arr) {
210
+            if(i%2==0) evens.add(i);
211
+            else odds.add(i);
212
+        }
213
+        for (Integer j: evens) {
214
+            result[count]=j;
215
+            count++;
216
+        }
217
+        for (Integer k:odds) {
218
+            result[count]=k;
219
+            count++;
220
+        }
221
+        return result;
222
+    }
124
 }
223
 }

+ 222
- 7
arraz/src/test/java/ArrazTest.java Целия файл

1
 import org.junit.Assert;
1
 import org.junit.Assert;
2
 import org.junit.Test;
2
 import org.junit.Test;
3
 
3
 
4
+import java.util.ArrayList;
5
+
4
 import static org.junit.Assert.*;
6
 import static org.junit.Assert.*;
5
 
7
 
6
 public class ArrazTest {
8
 public class ArrazTest {
75
 
77
 
76
     @Test
78
     @Test
77
     public void test1ReverseArray(){
79
     public void test1ReverseArray(){
78
-        int[] arr = new int[] {8,92,-32,12,-7,6,102,5,4};
79
-        Assert.assertEquals(arraz.reverse(spiffyHandyIntArray), spiffyHandyIntArray);
80
+        int[] expected = new int[] {8,92,-32,12,-7,6,102,5,4};
81
+        int[] actual = arraz.reverse(spiffyHandyIntArray);
82
+        for (int i = 0; i <actual.length ; i++) {
83
+            Assert.assertEquals(expected[i],actual[i]);
84
+        }
80
     }
85
     }
81
 
86
 
82
     @Test
87
     @Test
83
     public void test2ReverseArray(){
88
     public void test2ReverseArray(){
84
-        int[] arr = new int[] {8,92,-32,12,-7,6,102,5,4};
85
-        Assert.assertNotSame(arraz.reverse(spiffyHandyIntArray), arr);
89
+        int[] expected = new int[] {1,2,3};
90
+        int[] actual = arraz.reverse(expected);
91
+        for (int i = 0; i <actual.length ; i++) {
92
+            Assert.assertEquals(expected[i],actual[i]);
93
+        }
86
     }
94
     }
87
 
95
 
88
     @Test
96
     @Test
149
 
157
 
150
     @Test
158
     @Test
151
     public void test2RemoveElement(){
159
     public void test2RemoveElement(){
152
-        int [] arr = arraz.removeElement(spiffyHandyIntArray, 1);
153
-        Assert.assertFalse(arraz.containsValue(arr, 1));
160
+        int [] arr = arraz.removeElement(spiffyHandyIntArray, 4);
161
+        Assert.assertFalse(arraz.containsValue(arr, 4));
154
     }
162
     }
155
 
163
 
156
     @Test
164
     @Test
193
     }
201
     }
194
 
202
 
195
     @Test
203
     @Test
196
-    
204
+    public void test1Find2ndLargest(){
205
+        int result = arraz.find2ndLargest(spiffyHandyIntArray);
206
+        Assert.assertEquals(92, result);
207
+    }
208
+
209
+    @Test
210
+    public void test2Find2ndLargest(){
211
+        int[] arr = new int[]{-4,-3,-5,-2,-8,-2,-5};
212
+        int result = arraz.find2ndLargest(arr);
213
+        Assert.assertEquals(-2, result);
214
+    }
215
+
216
+    @Test
217
+    public void test1MakeArrayList(){
218
+        ArrayList<Integer> list = arraz.makeArrayList(spiffyHandyIntArray);
219
+        Assert.assertEquals(list.getClass(), ArrayList.class);
220
+    }
221
+
222
+    @Test
223
+    public void test2MakeArrayList(){
224
+        ArrayList<Integer> list = arraz.makeArrayList(spiffyHandyIntArray);
225
+        Assert.assertEquals(spiffyHandyIntArray.length, list.size());
226
+    }
227
+
228
+    @Test
229
+    public void test1MakeArray(){
230
+        ArrayList<Integer> list = new ArrayList<Integer>();
231
+        list.add(4);
232
+        list.add(3);
233
+        list.add(9);
234
+        list.add(8);
235
+        int[] arr = arraz.makeArray(list);
236
+        Assert.assertEquals(arr.getClass(), int[].class);
237
+    }
238
+
239
+    @Test
240
+    public void test2MakeArray(){
241
+        ArrayList<Integer> list = new ArrayList<Integer>();
242
+        list.add(4);
243
+        list.add(3);
244
+        list.add(9);
245
+        list.add(8);
246
+        int[] arr = arraz.makeArray(list);
247
+        Assert.assertEquals(list.size(), arr.length);
248
+    }
249
+
250
+    @Test
251
+    public void test1Check2Arrays(){
252
+        int[] testArr = new int[] {4,5,102,6,-7,12,-32,92,8};
253
+        boolean actual = arraz.check2Arrays(testArr,spiffyHandyIntArray);
254
+        Assert.assertTrue(actual);
255
+    }
256
+
257
+    @Test
258
+    public void test2Check2Arrays(){
259
+        int[] testArr = new int[] {4,5,102,6,-7,44,-32,92,8};
260
+        boolean actual = arraz.check2Arrays(testArr,spiffyHandyIntArray);
261
+        Assert.assertFalse(actual);
262
+    }
263
+
264
+    @Test
265
+    public void test1AverageWithoutMinMax(){
266
+        int actual = arraz.averageWithoutMinMax(spiffyHandyIntArray);
267
+        Assert.assertEquals(17, actual);
268
+    }
269
+
270
+    @Test
271
+    public void test2AverageWithoutMinMax(){
272
+        int[] testArr = new int[] {4,3,2,6,7,4,1};
273
+        int actual = arraz.averageWithoutMinMax(testArr);
274
+        Assert.assertEquals(3, actual);
275
+    }
276
+
277
+    @Test
278
+    public void test1Has65and77(){
279
+        int[] testArr = new int[] {4,3,2,6,7,4,1};
280
+        boolean actual = arraz.has65and77(testArr);
281
+        Assert.assertFalse(actual);
282
+    }
283
+
284
+    @Test
285
+    public void test2Has65and77(){
286
+        int[] testArr = new int[] {4,3,65,2,6,7,77,4,1};
287
+        boolean actual = arraz.has65and77(testArr);
288
+        Assert.assertTrue(actual);
289
+    }
290
+
291
+    @Test
292
+    public void test1TotalOf10sIs30(){
293
+        int[] testArr = new int[] {4,3,65,2,6,7,77,4,1};
294
+        boolean actual = arraz.toalOf10sIs30(testArr);
295
+        Assert.assertFalse(actual);
296
+    }
297
+
298
+    @Test
299
+    public void test2TotalOf10sIs30(){
300
+            int[] testArr = new int[] {4,3,10,2,6,7,10,4,10,1};
301
+            boolean actual = arraz.toalOf10sIs30(testArr);
302
+            Assert.assertTrue(actual);
303
+    }
304
+
305
+    @Test
306
+    public void test1makeCopyReverse(){
307
+        int[] actual = arraz.makeCopyReverse(spiffyHandyIntArray);
308
+        int[] arr = new int[] {8,92,-32,12,-7,6,102,5,4};
309
+        for (int i=0; i<arr.length; i++){
310
+            Assert.assertEquals(arr[i], actual[i]);
311
+        }
312
+    }
313
+
314
+    @Test
315
+    public void test2makeCopyReverse(){
316
+        int[] testArr = new int[] {4,3,2,6,7,4,1};
317
+        int[] actual = arraz.makeCopyReverse(testArr);
318
+        int[] arr = new int[] {1,4,7,6,2,3,4};
319
+        for (int i=0; i<arr.length; i++){
320
+            Assert.assertEquals(arr[i], actual[i]);
321
+        }
322
+    }
323
+
324
+    @Test
325
+    public void test1removeLastAndCopy(){
326
+        int[] testArr = new int[] {4,3,2,33,7,4,1};
327
+        int[] actual = arraz.removeLastAndCopy(testArr);
328
+        int[] arr = new int[] {4,3,2,33,7,4};
329
+        for (int i=0; i<arr.length; i++){
330
+            Assert.assertEquals(arr[i], actual[i]);
331
+        }
332
+    }
333
+
334
+    @Test
335
+    public void test2removeLastAndCopy(){
336
+        int[] testArr = new int[] {4,3,10,2,6,7,10,4,10,1};
337
+        int[] actual = arraz.removeLastAndCopy(testArr);
338
+        Assert.assertEquals(testArr.length-1,actual.length);
339
+    }
340
+
341
+    @Test
342
+    public void test1removeFirstAndCopy(){
343
+        int[] testArr = new int[] {4,3,2,33,7,9,1};
344
+        int[] actual = arraz.removeFirstAndCopy(testArr);
345
+        int[] arr = new int[] {3,2,33,7,9,1};
346
+        for (int i=0; i<arr.length; i++){
347
+            Assert.assertEquals(arr[i], actual[i]);
348
+        }
349
+    }
350
+
351
+    @Test
352
+    public void test2removeFirstAndCopy(){
353
+        int[] testArr = new int[] {4,3,10,2,6,7,10,4,10,1};
354
+        int[] actual = arraz.removeFirstAndCopy(testArr);
355
+       Assert.assertEquals(testArr.length-1, actual.length);
356
+    }
357
+
358
+    @Test
359
+    public void test1insertFirstAndCopy(){
360
+        int[] testArr = new int[] {4,3,2,33,7,9,1};
361
+        int[] actual = arraz.insertFirstAndCopy(testArr, 1);
362
+        int[] arr = new int[] {1,4,3,2,33,7,9,1};
363
+        for (int i=0; i<arr.length; i++){
364
+            Assert.assertEquals(arr[i], actual[i]);
365
+        }
366
+    }
367
+
368
+    @Test
369
+    public void test2insertFirstAndCopy(){
370
+        int[] testArr = new int[] {4,3,10,2,6,7,10,4,10,1};
371
+        int[] actual = arraz.insertFirstAndCopy(testArr,2);
372
+        Assert.assertEquals(testArr.length+1, actual.length);
373
+    }
374
+
375
+    @Test
376
+    public void test1insertEndAndCopy(){
377
+        int[] testArr = new int[] {4,3,2,33,7,9,1};
378
+        int[] actual = arraz.insertEndAndCopy(testArr, 1);
379
+        int[] arr = new int[] {4,3,2,33,7,9,1,1};
380
+        for (int i=0; i<arr.length; i++){
381
+            Assert.assertEquals(arr[i], actual[i]);
382
+        }
383
+    }
384
+
385
+    @Test
386
+    public void test2insertEndAndCopy(){
387
+        int[] testArr = new int[] {4,3,10,2,6,7,10,4,10,1};
388
+        int[] actual = arraz.insertEndAndCopy(testArr,2);
389
+        Assert.assertEquals(testArr.length+1, actual.length);
390
+    }
391
+
392
+    @Test
393
+    public void test1SortArrayEvenOdd(){
394
+        int[] spiffyHandyIntArray = new int[] {4,5,102,6,-7,12,-32,92,8};
395
+        int[] actual = arraz.sortArrayEvenOdd(spiffyHandyIntArray);
396
+        int[] expected = new int[]{4,102,6,12,-32,92,8,5,-7};
397
+        for (int i = 0; i < actual.length; i++) {
398
+            Assert.assertEquals(expected[i], actual[i]);
399
+        }
400
+    }
401
+
402
+    @Test
403
+    public void test2SortArrayEvenOdd(){
404
+        int[] testArr = new int[] {4,3,10,2,6,7,10,4,10,1};
405
+        int[] actual = arraz.sortArrayEvenOdd(testArr);
406
+        int[] expected = new int[]{4,10,2,6,10,4,10,3,7,1};
407
+        for (int i = 0; i < actual.length; i++) {
408
+            Assert.assertEquals(expected[i], actual[i]);
409
+        }
410
+    }
411
+
197
 }
412
 }