jpsp91 6 years ago
parent
commit
3415b7cdfc
11 changed files with 896 additions and 42 deletions
  1. 13
    0
      .idea/compiler.xml
  2. 14
    0
      .idea/misc.xml
  3. 6
    0
      .idea/vcs.xml
  4. 431
    0
      .idea/workspace.xml
  5. 74
    4
      PhoneBook.java
  6. 79
    29
      PhoneBookTest.java
  7. 2
    0
      ZCW-PhoneBook.iml
  8. 25
    9
      package.bluej
  9. 20
    0
      pom.xml
  10. 124
    0
      src/main/java/PhoneBook.java
  11. 108
    0
      src/test/java/PhoneBookTest.java

+ 13
- 0
.idea/compiler.xml View File

@@ -0,0 +1,13 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="CompilerConfiguration">
4
+    <annotationProcessing>
5
+      <profile name="Maven default annotation processors profile" enabled="true">
6
+        <sourceOutputDir name="target/generated-sources/annotations" />
7
+        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
8
+        <outputRelativeToContentRoot value="true" />
9
+        <module name="ZCW-PhoneBook" />
10
+      </profile>
11
+    </annotationProcessing>
12
+  </component>
13
+</project>

+ 14
- 0
.idea/misc.xml View File

@@ -0,0 +1,14 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ExternalStorageConfigurationManager" enabled="true" />
4
+  <component name="MavenProjectsManager">
5
+    <option name="originalFiles">
6
+      <list>
7
+        <option value="$PROJECT_DIR$/pom.xml" />
8
+      </list>
9
+    </option>
10
+  </component>
11
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
12
+    <output url="file://$PROJECT_DIR$/out" />
13
+  </component>
14
+</project>

+ 6
- 0
.idea/vcs.xml View File

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

+ 431
- 0
.idea/workspace.xml View File

@@ -0,0 +1,431 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ChangeListManager">
4
+    <list default="true" id="9aae1cf3-1759-494b-9e8b-4830cc0896f0" name="Default" comment="">
5
+      <change afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
6
+      <change beforePath="$PROJECT_DIR$/PhoneBook.java" beforeDir="false" afterPath="$PROJECT_DIR$/PhoneBook.java" afterDir="false" />
7
+      <change beforePath="$PROJECT_DIR$/PhoneBookTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/PhoneBookTest.java" afterDir="false" />
8
+      <change beforePath="$PROJECT_DIR$/package.bluej" beforeDir="false" afterPath="$PROJECT_DIR$/package.bluej" afterDir="false" />
9
+    </list>
10
+    <ignored path="$PROJECT_DIR$/out/" />
11
+    <ignored path="$PROJECT_DIR$/target/" />
12
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
13
+    <option name="TRACKING_ENABLED" value="true" />
14
+    <option name="SHOW_DIALOG" value="false" />
15
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
16
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
17
+    <option name="LAST_RESOLUTION" value="IGNORE" />
18
+  </component>
19
+  <component name="FileEditorManager">
20
+    <leaf>
21
+      <file leaf-file-name="pom.xml" pinned="false" current-in-tab="false">
22
+        <entry file="file://$PROJECT_DIR$/pom.xml">
23
+          <provider selected="true" editor-type-id="text-editor">
24
+            <state relative-caret-position="165">
25
+              <caret line="19" column="10" selection-start-line="19" selection-start-column="10" selection-end-line="19" selection-end-column="10" />
26
+            </state>
27
+          </provider>
28
+        </entry>
29
+      </file>
30
+      <file leaf-file-name="PhoneBook.java" pinned="false" current-in-tab="true">
31
+        <entry file="file://$PROJECT_DIR$/src/main/java/PhoneBook.java">
32
+          <provider selected="true" editor-type-id="text-editor">
33
+            <state relative-caret-position="60">
34
+              <caret line="4" column="24" lean-forward="true" selection-start-line="4" selection-start-column="24" selection-end-line="4" selection-end-column="24" />
35
+              <folding>
36
+                <element signature="imports" expanded="true" />
37
+                <element signature="e#122#138#0" expanded="true" />
38
+                <element signature="e#1578#1594#0" expanded="true" />
39
+              </folding>
40
+            </state>
41
+          </provider>
42
+        </entry>
43
+      </file>
44
+      <file leaf-file-name="PhoneBookTest.java" pinned="false" current-in-tab="false">
45
+        <entry file="file://$PROJECT_DIR$/src/test/java/PhoneBookTest.java">
46
+          <provider selected="true" editor-type-id="text-editor">
47
+            <state relative-caret-position="374">
48
+              <caret line="98" lean-forward="true" selection-start-line="98" selection-end-line="98" />
49
+              <folding>
50
+                <element signature="imports" expanded="true" />
51
+              </folding>
52
+            </state>
53
+          </provider>
54
+        </entry>
55
+      </file>
56
+    </leaf>
57
+  </component>
58
+  <component name="FileTemplateManagerImpl">
59
+    <option name="RECENT_TEMPLATES">
60
+      <list>
61
+        <option value="Class" />
62
+      </list>
63
+    </option>
64
+  </component>
65
+  <component name="Git.Settings">
66
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
67
+  </component>
68
+  <component name="IdeDocumentHistory">
69
+    <option name="CHANGED_PATHS">
70
+      <list>
71
+        <option value="$PROJECT_DIR$/src/test/java/PhoneBookTest.java" />
72
+        <option value="$PROJECT_DIR$/src/main/java/PhoneBook.java" />
73
+      </list>
74
+    </option>
75
+  </component>
76
+  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
77
+  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
78
+  <component name="JsGulpfileManager">
79
+    <detection-done>true</detection-done>
80
+    <sorting>DEFINITION_ORDER</sorting>
81
+  </component>
82
+  <component name="NodePackageJsonFileManager">
83
+    <packageJsonPaths />
84
+  </component>
85
+  <component name="ProjectFrameBounds" extendedState="6">
86
+    <option name="y" value="23" />
87
+    <option name="width" value="1280" />
88
+    <option name="height" value="721" />
89
+  </component>
90
+  <component name="ProjectView">
91
+    <navigator proportions="" version="1">
92
+      <foldersAlwaysOnTop value="true" />
93
+    </navigator>
94
+    <panes>
95
+      <pane id="AndroidView" />
96
+      <pane id="Scope" />
97
+      <pane id="PackagesPane" />
98
+      <pane id="ProjectPane">
99
+        <subPane>
100
+          <expand>
101
+            <path>
102
+              <item name="ZCW-PhoneBook" type="b2602c69:ProjectViewProjectNode" />
103
+              <item name="ZCW-PhoneBook" type="462c0819:PsiDirectoryNode" />
104
+            </path>
105
+            <path>
106
+              <item name="ZCW-PhoneBook" type="b2602c69:ProjectViewProjectNode" />
107
+              <item name="ZCW-PhoneBook" type="462c0819:PsiDirectoryNode" />
108
+              <item name="src" type="462c0819:PsiDirectoryNode" />
109
+            </path>
110
+            <path>
111
+              <item name="ZCW-PhoneBook" type="b2602c69:ProjectViewProjectNode" />
112
+              <item name="ZCW-PhoneBook" type="462c0819:PsiDirectoryNode" />
113
+              <item name="src" type="462c0819:PsiDirectoryNode" />
114
+              <item name="main" type="462c0819:PsiDirectoryNode" />
115
+            </path>
116
+            <path>
117
+              <item name="ZCW-PhoneBook" type="b2602c69:ProjectViewProjectNode" />
118
+              <item name="ZCW-PhoneBook" type="462c0819:PsiDirectoryNode" />
119
+              <item name="src" type="462c0819:PsiDirectoryNode" />
120
+              <item name="main" type="462c0819:PsiDirectoryNode" />
121
+              <item name="java" type="462c0819:PsiDirectoryNode" />
122
+            </path>
123
+            <path>
124
+              <item name="ZCW-PhoneBook" type="b2602c69:ProjectViewProjectNode" />
125
+              <item name="ZCW-PhoneBook" type="462c0819:PsiDirectoryNode" />
126
+              <item name="src" type="462c0819:PsiDirectoryNode" />
127
+              <item name="test" type="462c0819:PsiDirectoryNode" />
128
+            </path>
129
+            <path>
130
+              <item name="ZCW-PhoneBook" type="b2602c69:ProjectViewProjectNode" />
131
+              <item name="ZCW-PhoneBook" type="462c0819:PsiDirectoryNode" />
132
+              <item name="src" type="462c0819:PsiDirectoryNode" />
133
+              <item name="test" type="462c0819:PsiDirectoryNode" />
134
+              <item name="java" type="462c0819:PsiDirectoryNode" />
135
+            </path>
136
+          </expand>
137
+          <select />
138
+        </subPane>
139
+      </pane>
140
+    </panes>
141
+  </component>
142
+  <component name="PropertiesComponent">
143
+    <property name="WebServerToolWindowFactoryState" value="false" />
144
+    <property name="aspect.path.notification.shown" value="true" />
145
+    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
146
+    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
147
+    <property name="settings.editor.selected.configurable" value="reference.projectsettings.compiler.javacompiler" />
148
+  </component>
149
+  <component name="RunDashboard">
150
+    <option name="ruleStates">
151
+      <list>
152
+        <RuleState>
153
+          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
154
+        </RuleState>
155
+        <RuleState>
156
+          <option name="name" value="StatusDashboardGroupingRule" />
157
+        </RuleState>
158
+      </list>
159
+    </option>
160
+  </component>
161
+  <component name="RunManager" selected="JUnit.PhoneBookTest.displayNumberTest">
162
+    <configuration default="true" type="Application" factoryName="Application">
163
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
164
+    </configuration>
165
+    <configuration name="PhoneBookTest.addNumberTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
166
+      <module name="ZCW-PhoneBook" />
167
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
168
+      <option name="ALTERNATIVE_JRE_PATH" />
169
+      <option name="PACKAGE_NAME" value="" />
170
+      <option name="MAIN_CLASS_NAME" value="PhoneBookTest" />
171
+      <option name="METHOD_NAME" value="addNumberTest" />
172
+      <option name="TEST_OBJECT" value="method" />
173
+      <option name="VM_PARAMETERS" value="-ea" />
174
+      <option name="PARAMETERS" />
175
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
176
+      <option name="PASS_PARENT_ENVS" value="true" />
177
+      <option name="TEST_SEARCH_SCOPE">
178
+        <value defaultName="singleModule" />
179
+      </option>
180
+      <patterns />
181
+    </configuration>
182
+    <configuration name="PhoneBookTest.displayNumberTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
183
+      <module name="ZCW-PhoneBook" />
184
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
185
+      <option name="ALTERNATIVE_JRE_PATH" />
186
+      <option name="PACKAGE_NAME" value="" />
187
+      <option name="MAIN_CLASS_NAME" value="PhoneBookTest" />
188
+      <option name="METHOD_NAME" value="displayNumberTest" />
189
+      <option name="TEST_OBJECT" value="method" />
190
+      <option name="VM_PARAMETERS" value="-ea" />
191
+      <option name="PARAMETERS" />
192
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
193
+      <option name="PASS_PARENT_ENVS" value="true" />
194
+      <option name="TEST_SEARCH_SCOPE">
195
+        <value defaultName="singleModule" />
196
+      </option>
197
+      <patterns />
198
+    </configuration>
199
+    <configuration name="PhoneBookTest.lookUpNumberTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
200
+      <module name="ZCW-PhoneBook" />
201
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
202
+      <option name="ALTERNATIVE_JRE_PATH" />
203
+      <option name="PACKAGE_NAME" value="" />
204
+      <option name="MAIN_CLASS_NAME" value="PhoneBookTest" />
205
+      <option name="METHOD_NAME" value="lookUpNumberTest" />
206
+      <option name="TEST_OBJECT" value="method" />
207
+      <option name="VM_PARAMETERS" value="-ea" />
208
+      <option name="PARAMETERS" />
209
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
210
+      <option name="PASS_PARENT_ENVS" value="true" />
211
+      <option name="TEST_SEARCH_SCOPE">
212
+        <value defaultName="singleModule" />
213
+      </option>
214
+      <patterns />
215
+    </configuration>
216
+    <configuration name="PhoneBookTest.removeNumberTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
217
+      <module name="ZCW-PhoneBook" />
218
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
219
+      <option name="ALTERNATIVE_JRE_PATH" />
220
+      <option name="PACKAGE_NAME" value="" />
221
+      <option name="MAIN_CLASS_NAME" value="PhoneBookTest" />
222
+      <option name="METHOD_NAME" value="removeNumberTest" />
223
+      <option name="TEST_OBJECT" value="method" />
224
+      <option name="VM_PARAMETERS" value="-ea" />
225
+      <option name="PARAMETERS" />
226
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
227
+      <option name="PASS_PARENT_ENVS" value="true" />
228
+      <option name="TEST_SEARCH_SCOPE">
229
+        <value defaultName="singleModule" />
230
+      </option>
231
+      <patterns />
232
+    </configuration>
233
+    <configuration name="PhoneBookTest.reverseLookUpTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
234
+      <module name="ZCW-PhoneBook" />
235
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
236
+      <option name="ALTERNATIVE_JRE_PATH" />
237
+      <option name="PACKAGE_NAME" value="" />
238
+      <option name="MAIN_CLASS_NAME" value="PhoneBookTest" />
239
+      <option name="METHOD_NAME" value="reverseLookUpTest" />
240
+      <option name="TEST_OBJECT" value="method" />
241
+      <option name="VM_PARAMETERS" value="-ea" />
242
+      <option name="PARAMETERS" />
243
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
244
+      <option name="PASS_PARENT_ENVS" value="true" />
245
+      <option name="TEST_SEARCH_SCOPE">
246
+        <value defaultName="singleModule" />
247
+      </option>
248
+      <patterns />
249
+    </configuration>
250
+    <configuration default="true" type="JUnit" factoryName="JUnit">
251
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
252
+      <option name="ALTERNATIVE_JRE_PATH" />
253
+      <option name="PACKAGE_NAME" />
254
+      <option name="MAIN_CLASS_NAME" />
255
+      <option name="METHOD_NAME" />
256
+      <option name="TEST_OBJECT" value="class" />
257
+      <option name="VM_PARAMETERS" value="-ea" />
258
+      <option name="PARAMETERS" />
259
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
260
+      <option name="PASS_PARENT_ENVS" value="true" />
261
+      <option name="TEST_SEARCH_SCOPE">
262
+        <value defaultName="singleModule" />
263
+      </option>
264
+      <patterns />
265
+    </configuration>
266
+    <configuration default="true" type="TestNG" factoryName="TestNG">
267
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
268
+      <option name="ALTERNATIVE_JRE_PATH" />
269
+      <option name="SUITE_NAME" />
270
+      <option name="PACKAGE_NAME" />
271
+      <option name="MAIN_CLASS_NAME" />
272
+      <option name="METHOD_NAME" />
273
+      <option name="GROUP_NAME" />
274
+      <option name="TEST_OBJECT" value="CLASS" />
275
+      <option name="VM_PARAMETERS" value="-ea" />
276
+      <option name="PARAMETERS" />
277
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
278
+      <option name="OUTPUT_DIRECTORY" />
279
+      <option name="PASS_PARENT_ENVS" value="true" />
280
+      <option name="TEST_SEARCH_SCOPE">
281
+        <value defaultName="singleModule" />
282
+      </option>
283
+      <option name="USE_DEFAULT_REPORTERS" value="false" />
284
+      <option name="PROPERTIES_FILE" />
285
+      <properties />
286
+      <listeners />
287
+    </configuration>
288
+    <list>
289
+      <item itemvalue="JUnit.PhoneBookTest.addNumberTest" />
290
+      <item itemvalue="JUnit.PhoneBookTest.removeNumberTest" />
291
+      <item itemvalue="JUnit.PhoneBookTest.lookUpNumberTest" />
292
+      <item itemvalue="JUnit.PhoneBookTest.reverseLookUpTest" />
293
+      <item itemvalue="JUnit.PhoneBookTest.displayNumberTest" />
294
+    </list>
295
+    <recent_temporary>
296
+      <list>
297
+        <item itemvalue="JUnit.PhoneBookTest.displayNumberTest" />
298
+        <item itemvalue="JUnit.PhoneBookTest.reverseLookUpTest" />
299
+        <item itemvalue="JUnit.PhoneBookTest.lookUpNumberTest" />
300
+        <item itemvalue="JUnit.PhoneBookTest.removeNumberTest" />
301
+        <item itemvalue="JUnit.PhoneBookTest.addNumberTest" />
302
+      </list>
303
+    </recent_temporary>
304
+  </component>
305
+  <component name="SvnConfiguration">
306
+    <configuration />
307
+  </component>
308
+  <component name="TaskManager">
309
+    <task active="true" id="Default" summary="Default task">
310
+      <changelist id="9aae1cf3-1759-494b-9e8b-4830cc0896f0" name="Default" comment="" />
311
+      <created>1529207291560</created>
312
+      <option name="number" value="Default" />
313
+      <option name="presentableId" value="Default" />
314
+      <updated>1529207291560</updated>
315
+      <workItem from="1529207294055" duration="23170000" />
316
+    </task>
317
+    <servers />
318
+  </component>
319
+  <component name="TestHistory">
320
+    <history-entry file="PhoneBookTest_addNumberTest - 2018.06.17 at 01h 44m 40s.xml">
321
+      <configuration name="PhoneBookTest.addNumberTest" configurationId="JUnit" />
322
+    </history-entry>
323
+    <history-entry file="PhoneBookTest_addNumberTest - 2018.06.17 at 01h 53m 16s.xml">
324
+      <configuration name="PhoneBookTest.addNumberTest" configurationId="JUnit" />
325
+    </history-entry>
326
+    <history-entry file="PhoneBookTest_addNumberTest - 2018.06.17 at 01h 55m 27s.xml">
327
+      <configuration name="PhoneBookTest.addNumberTest" configurationId="JUnit" />
328
+    </history-entry>
329
+    <history-entry file="PhoneBookTest_removeNumberTest - 2018.06.17 at 02h 12m 58s.xml">
330
+      <configuration name="PhoneBookTest.removeNumberTest" configurationId="JUnit" />
331
+    </history-entry>
332
+    <history-entry file="PhoneBookTest_removeNumberTest - 2018.06.17 at 02h 13m 40s.xml">
333
+      <configuration name="PhoneBookTest.removeNumberTest" configurationId="JUnit" />
334
+    </history-entry>
335
+    <history-entry file="PhoneBookTest_lookUpNumberTest - 2018.06.17 at 02h 52m 55s.xml">
336
+      <configuration name="PhoneBookTest.lookUpNumberTest" configurationId="JUnit" />
337
+    </history-entry>
338
+    <history-entry file="PhoneBookTest_lookUpNumberTest - 2018.06.17 at 03h 01m 02s.xml">
339
+      <configuration name="PhoneBookTest.lookUpNumberTest" configurationId="JUnit" />
340
+    </history-entry>
341
+    <history-entry file="PhoneBookTest_reverseLookUpTest - 2018.06.17 at 15h 13m 04s.xml">
342
+      <configuration name="PhoneBookTest.reverseLookUpTest" configurationId="JUnit" />
343
+    </history-entry>
344
+    <history-entry file="PhoneBookTest_displayNumberTest - 2018.06.17 at 18h 06m 39s.xml">
345
+      <configuration name="PhoneBookTest.displayNumberTest" configurationId="JUnit" />
346
+    </history-entry>
347
+    <history-entry file="PhoneBookTest_displayNumberTest - 2018.06.17 at 23h 53m 33s.xml">
348
+      <configuration name="PhoneBookTest.displayNumberTest" configurationId="JUnit" />
349
+    </history-entry>
350
+  </component>
351
+  <component name="TimeTrackingManager">
352
+    <option name="totallyTimeSpent" value="23170000" />
353
+  </component>
354
+  <component name="ToolWindowManager">
355
+    <frame x="-1" y="23" width="1280" height="721" extended-state="6" />
356
+    <editor active="true" />
357
+    <layout>
358
+      <window_info anchor="right" id="Palette" />
359
+      <window_info anchor="bottom" id="TODO" order="6" />
360
+      <window_info anchor="bottom" id="Messages" weight="0.32766616" />
361
+      <window_info anchor="right" id="Palette&#9;" />
362
+      <window_info id="Image Layers" />
363
+      <window_info anchor="right" id="Capture Analysis" />
364
+      <window_info anchor="bottom" id="Event Log" side_tool="true" />
365
+      <window_info anchor="right" id="Maven Projects" />
366
+      <window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
367
+      <window_info anchor="bottom" id="Run" order="2" weight="0.4064915" />
368
+      <window_info anchor="bottom" id="Version Control" />
369
+      <window_info anchor="bottom" id="Terminal" />
370
+      <window_info id="Capture Tool" />
371
+      <window_info id="Designer" />
372
+      <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.15" />
373
+      <window_info anchor="right" id="Database" />
374
+      <window_info id="Learn" />
375
+      <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
376
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
377
+      <window_info id="UI Designer" />
378
+      <window_info anchor="right" id="Theme Preview" />
379
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
380
+      <window_info id="Favorites" side_tool="true" />
381
+      <window_info anchor="bottom" id="Find" order="1" />
382
+      <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
383
+      <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
384
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
385
+      <window_info anchor="bottom" id="Message" order="0" />
386
+      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
387
+    </layout>
388
+  </component>
389
+  <component name="TypeScriptGeneratedFilesManager">
390
+    <option name="version" value="1" />
391
+  </component>
392
+  <component name="VcsContentAnnotationSettings">
393
+    <option name="myLimit" value="2678400000" />
394
+  </component>
395
+  <component name="XDebuggerManager">
396
+    <breakpoint-manager>
397
+      <option name="time" value="1" />
398
+    </breakpoint-manager>
399
+  </component>
400
+  <component name="editorHistoryManager">
401
+    <entry file="file://$PROJECT_DIR$/pom.xml">
402
+      <provider selected="true" editor-type-id="text-editor">
403
+        <state relative-caret-position="165">
404
+          <caret line="19" column="10" selection-start-line="19" selection-start-column="10" selection-end-line="19" selection-end-column="10" />
405
+        </state>
406
+      </provider>
407
+    </entry>
408
+    <entry file="file://$PROJECT_DIR$/src/test/java/PhoneBookTest.java">
409
+      <provider selected="true" editor-type-id="text-editor">
410
+        <state relative-caret-position="374">
411
+          <caret line="98" lean-forward="true" selection-start-line="98" selection-end-line="98" />
412
+          <folding>
413
+            <element signature="imports" expanded="true" />
414
+          </folding>
415
+        </state>
416
+      </provider>
417
+    </entry>
418
+    <entry file="file://$PROJECT_DIR$/src/main/java/PhoneBook.java">
419
+      <provider selected="true" editor-type-id="text-editor">
420
+        <state relative-caret-position="60">
421
+          <caret line="4" column="24" lean-forward="true" selection-start-line="4" selection-start-column="24" selection-end-line="4" selection-end-column="24" />
422
+          <folding>
423
+            <element signature="imports" expanded="true" />
424
+            <element signature="e#122#138#0" expanded="true" />
425
+            <element signature="e#1578#1594#0" expanded="true" />
426
+          </folding>
427
+        </state>
428
+      </provider>
429
+    </entry>
430
+  </component>
431
+</project>

+ 74
- 4
PhoneBook.java View File

@@ -1,7 +1,77 @@
1
- 
1
+import java.util.HashMap;
2
+import java.util.Map;
3
+import java.util.TreeMap;
2 4
 
3
-/**
4
- * Created by leon on 1/23/18.
5
- */
6 5
 public class PhoneBook {
6
+
7
+    Map<String, String> phoneBook = new HashMap<String, String>();
8
+
9
+    public String add(String name, String number) {
10
+
11
+        phoneBook.put(name, number);
12
+
13
+        return (name + " " + phoneBook.get(name));
14
+
15
+        //           phoneBook.put("Albert", "302-123-4567");
16
+        //           phoneBook.put("Bobby", "302-111-1111");
17
+        //           phoneBook.put("Clyde", "302-222-2222");
18
+        //           phoneBook.put("Drew", "302-333-3333");
19
+        //
20
+        //           System.out.println(phoneBook.size());
21
+        //
22
+        //           System.out.println(phoneBook.get("Clyde" + "\n"));
23
+        //
24
+        //           for(Map.Entry<String, String> list : phoneBook.entrySet()){
25
+        //
26
+        //               String key = list.getKey();
27
+        //               String value = list.getValue();
28
+        //               System.out.println(key + " " + value);
29
+        //
30
+        //           }
31
+
32
+    }
33
+
34
+    public String remove(String name) {
35
+
36
+        phoneBook.remove(name);
37
+
38
+        return name;
39
+    }
40
+
41
+    public String lookUp(String name) {
42
+        phoneBook.get(name);
43
+        return phoneBook.get(name);
44
+    }
45
+
46
+    public String reverseLookUp(String number) {
47
+        String result = "";
48
+        //need to import Entry class
49
+        for (Map.Entry<String, String> entry : phoneBook.entrySet()) {
50
+            if (entry.getValue().equals(number)) {
51
+                result = (entry.getKey());
52
+            }
53
+        }
54
+
55
+        return result;
56
+    }
57
+
58
+    public String displayPhoneBook(){
59
+
60
+        String result = "";
61
+        //this converts a Hash Map into a sorted Tree Map
62
+        TreeMap<String, String> treePhoneBook = new TreeMap<String, String>(phoneBook);
63
+
64
+        for (Map.Entry<String, String> entry : treePhoneBook.entrySet()){
65
+
66
+            //must append onto the string
67
+            result += (entry.getKey() + " " + entry.getValue() + "\n");
68
+
69
+        }
70
+
71
+        return result;
72
+    }
73
+
7 74
 }
75
+
76
+
77
+

+ 79
- 29
PhoneBookTest.java View File

@@ -1,42 +1,92 @@
1
-
2
-
3 1
 import static org.junit.Assert.*;
4 2
 import org.junit.After;
3
+import org.junit.Assert;
5 4
 import org.junit.Before;
6 5
 import org.junit.Test;
7 6
 
8
-/**
9
- * The test class PhoneBookTest.
10
- *
11
- * @author  (your name)
12
- * @version (a version number or a date)
13
- */
14 7
 public class PhoneBookTest
15 8
 {
16
-    /**
17
-     * Default constructor for test class PhoneBookTest
18
-     */
19
-    public PhoneBookTest()
20
-    {
9
+    PhoneBook pBookTest = new PhoneBook();
10
+
11
+    @Test
12
+    public void addNumberTest(){
13
+        //when
14
+        //pBook.add("Police", "9-1-1");
15
+
16
+        //expected
17
+        String expected = "Police 9-1-1";
18
+
19
+        //actual
20
+        String actual = pBookTest.add("Police","9-1-1");
21
+
22
+        Assert.assertEquals(expected, actual);
23
+
24
+    }
25
+
26
+
27
+    @Test
28
+    public void removeNumberTest(){
29
+        //expected
30
+        String expected = "Police";
31
+
32
+        //actual
33
+        String actual = pBookTest.remove("Police");
34
+
35
+        Assert.assertEquals(expected, actual);
36
+
37
+    }
38
+
39
+
40
+    @Test
41
+    public void lookUpNumberTest(){
42
+        //when
43
+        pBookTest.add("John Doe", "111-111-1111");
44
+
45
+        //expected
46
+        String expected = "111-111-1111";
47
+
48
+        //actual
49
+        String actual = pBookTest.lookUp("John Doe");
50
+
51
+        Assert.assertEquals(expected, actual);
21 52
     }
22 53
 
23
-    /**
24
-     * Sets up the test fixture.
25
-     *
26
-     * Called before every test case method.
27
-     */
28
-    @Before
29
-    public void setUp()
30
-    {
54
+
55
+    @Test
56
+    public void reverseLookUpTest(){
57
+        //when
58
+        pBookTest.add("James Bond", "098-765-4321");
59
+
60
+        //expected
61
+        String expected = "James Bond";
62
+
63
+        //actual
64
+        String actual = pBookTest.reverseLookUp("098-765-4321");
65
+
66
+        Assert.assertEquals(expected, actual);
31 67
     }
32 68
 
33
-    /**
34
-     * Tears down the test fixture.
35
-     *
36
-     * Called after every test case method.
37
-     */
38
-    @After
39
-    public void tearDown()
40
-    {
69
+
70
+    @Test
71
+    public void displayNumberTest(){
72
+        //when
73
+        pBookTest.add("Carol", "333-333-3333");
74
+        pBookTest.add("Bruce", "222-222-2222");
75
+        pBookTest.add("Alice", "111-111-1111");
76
+
77
+        //expected
78
+        String expected = "Alice 111-111-1111\n" +
79
+            "Bruce 222-222-2222\n" +
80
+            "Carol 333-333-3333\n";
81
+
82
+        //actual
83
+        String actual = pBookTest.displayPhoneBook();
84
+
85
+        Assert.assertEquals(expected, actual);
41 86
     }
87
+
88
+
89
+
90
+
91
+
42 92
 }

+ 2
- 0
ZCW-PhoneBook.iml View File

@@ -0,0 +1,2 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<module type="JAVA_MODULE" version="4" />

+ 25
- 9
package.bluej View File

@@ -1,20 +1,23 @@
1 1
 #BlueJ package file
2
-editor.fx.0.height=0
3
-editor.fx.0.width=0
4
-editor.fx.0.x=0
5
-editor.fx.0.y=0
2
+dependency1.from=PhoneBookTest
3
+dependency1.to=PhoneBook
4
+dependency1.type=UsesDependency
5
+editor.fx.0.height=721
6
+editor.fx.0.width=800
7
+editor.fx.0.x=283
8
+editor.fx.0.y=23
6 9
 objectbench.height=101
7 10
 objectbench.width=461
8 11
 package.divider.horizontal=0.6
9 12
 package.divider.vertical=0.8007380073800738
10 13
 package.editor.height=427
11 14
 package.editor.width=674
12
-package.editor.x=427
13
-package.editor.y=143
15
+package.editor.x=243
16
+package.editor.y=69
14 17
 package.frame.height=600
15 18
 package.frame.width=800
16
-package.numDependencies=0
17
-package.numTargets=1
19
+package.numDependencies=1
20
+package.numTargets=2
18 21
 package.showExtends=true
19 22
 package.showUses=true
20 23
 project.charset=UTF-8
@@ -23,4 +26,17 @@ readme.name=@README
23 26
 readme.width=47
24 27
 readme.x=10
25 28
 readme.y=10
26
-
29
+target1.height=50
30
+target1.name=PhoneBookTest
31
+target1.showInterface=false
32
+target1.type=UnitTestTargetJunit4
33
+target1.width=120
34
+target1.x=100
35
+target1.y=10
36
+target2.height=50
37
+target2.name=PhoneBook
38
+target2.showInterface=false
39
+target2.type=ClassTarget
40
+target2.width=100
41
+target2.x=80
42
+target2.y=90

+ 20
- 0
pom.xml View File

@@ -0,0 +1,20 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0"
3
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+    <modelVersion>4.0.0</modelVersion>
6
+
7
+    <groupId>PhoneBook</groupId>
8
+    <artifactId>.</artifactId>
9
+    <version>1.0-SNAPSHOT</version>
10
+    <dependencies>
11
+        <dependency>
12
+            <groupId>junit</groupId>
13
+            <artifactId>junit</artifactId>
14
+            <version>RELEASE</version>
15
+            <scope>test</scope>
16
+        </dependency>
17
+    </dependencies>
18
+
19
+
20
+</project>

+ 124
- 0
src/main/java/PhoneBook.java View File

@@ -0,0 +1,124 @@
1
+import java.util.HashMap;
2
+import java.util.Map;
3
+import java.util.TreeMap;
4
+
5
+public class PhoneBook {
6
+
7
+    Map<String, String> phoneBook = new HashMap<String, String>();
8
+
9
+    public String add(String name, String number) {
10
+
11
+        phoneBook.put(name, number);
12
+
13
+        return (name + " " + phoneBook.get(name));
14
+
15
+
16
+//           phoneBook.put("Albert", "302-123-4567");
17
+//           phoneBook.put("Bobby", "302-111-1111");
18
+//           phoneBook.put("Clyde", "302-222-2222");
19
+//           phoneBook.put("Drew", "302-333-3333");
20
+//
21
+//           System.out.println(phoneBook.size());
22
+//
23
+//           System.out.println(phoneBook.get("Clyde" + "\n"));
24
+//
25
+//           for(Map.Entry<String, String> list : phoneBook.entrySet()){
26
+//
27
+//               String key = list.getKey();
28
+//               String value = list.getValue();
29
+//               System.out.println(key + " " + value);
30
+//
31
+//           }
32
+
33
+
34
+    }
35
+
36
+
37
+    public String remove(String name) {
38
+
39
+        phoneBook.remove(name);
40
+
41
+
42
+        return name;
43
+    }
44
+
45
+
46
+    public String lookUp(String name) {
47
+
48
+        phoneBook.get(name);
49
+
50
+        return phoneBook.get(name);
51
+    }
52
+
53
+
54
+
55
+
56
+    public String reverseLookUp(String number) {
57
+
58
+        String result = "";
59
+
60
+        //need to import Entry class
61
+        for (Map.Entry<String, String> entry : phoneBook.entrySet()) {
62
+            if (entry.getValue().equals(number)) {
63
+                result = (entry.getKey());
64
+            }
65
+        }
66
+
67
+        return result;
68
+    }
69
+
70
+
71
+public String displayPhoneBook(){
72
+
73
+
74
+    String result = "";
75
+
76
+    //this converts a Hash Map into a sorted Tree Map
77
+    TreeMap<String, String> treePhoneBook = new TreeMap<String, String>(phoneBook);
78
+
79
+    for (Map.Entry<String, String> entry : treePhoneBook.entrySet()){
80
+
81
+        //must append onto the string
82
+        result += (entry.getKey() + " " + entry.getValue() + "\n");
83
+
84
+    }
85
+
86
+
87
+    return result;
88
+    }
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+}
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+

+ 108
- 0
src/test/java/PhoneBookTest.java View File

@@ -0,0 +1,108 @@
1
+import static org.junit.Assert.*;
2
+import org.junit.After;
3
+import org.junit.Assert;
4
+import org.junit.Before;
5
+import org.junit.Test;
6
+
7
+public class PhoneBookTest
8
+{
9
+    PhoneBook pBookTest = new PhoneBook();
10
+
11
+    @Test
12
+    public void addNumberTest(){
13
+    //when
14
+    //pBook.add("Police", "9-1-1");
15
+
16
+    //expected
17
+    String expected = "Police 9-1-1";
18
+
19
+    //actual
20
+    String actual = pBookTest.add("Police","9-1-1");
21
+
22
+    Assert.assertEquals(expected, actual);
23
+
24
+    }
25
+
26
+
27
+
28
+    @Test
29
+    public void removeNumberTest(){
30
+        //expected
31
+        String expected = "Police";
32
+
33
+        //actual
34
+        String actual = pBookTest.remove("Police");
35
+
36
+        Assert.assertEquals(expected, actual);
37
+
38
+
39
+    }
40
+
41
+
42
+
43
+
44
+    @Test
45
+    public void lookUpNumberTest(){
46
+        //when
47
+        pBookTest.add("John Doe", "111-111-1111");
48
+
49
+        //expected
50
+        String expected = "111-111-1111";
51
+
52
+        //actual
53
+        String actual = pBookTest.lookUp("John Doe");
54
+
55
+        Assert.assertEquals(expected, actual);
56
+    }
57
+
58
+
59
+
60
+    @Test
61
+    public void reverseLookUpTest(){
62
+    //when
63
+    pBookTest.add("James Bond", "098-765-4321");
64
+
65
+    //expected
66
+    String expected = "James Bond";
67
+
68
+    //actual
69
+    String actual = pBookTest.reverseLookUp("098-765-4321");
70
+
71
+    Assert.assertEquals(expected, actual);
72
+    }
73
+
74
+
75
+
76
+    @Test
77
+    public void displayNumberTest(){
78
+    //when
79
+    pBookTest.add("Carol", "333-333-3333");
80
+    pBookTest.add("Bruce", "222-222-2222");
81
+    pBookTest.add("Alice", "111-111-1111");
82
+
83
+    //expected
84
+    String expected = "Alice 111-111-1111\n" +
85
+                      "Bruce 222-222-2222\n" +
86
+                      "Carol 333-333-3333\n";
87
+
88
+    //actual
89
+    String actual = pBookTest.displayPhoneBook();
90
+
91
+    Assert.assertEquals(expected, actual);
92
+    }
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+}