Quellcode durchsuchen

started implementing my own arraylist then saw everyone else just using arraylist... so i did that in 10 seconds and i'm done

NedRedmond vor 6 Jahren
Ursprung
Commit
c02bf75ea8

+ 16
- 0
Checkbook/.idea/compiler.xml Datei anzeigen

@@ -0,0 +1,16 @@
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="Checkbook" />
10
+      </profile>
11
+    </annotationProcessing>
12
+    <bytecodeTargetLevel>
13
+      <module name="Checkbook" target="1.8" />
14
+    </bytecodeTargetLevel>
15
+  </component>
16
+</project>

+ 4
- 0
Checkbook/.idea/encodings.xml Datei anzeigen

@@ -0,0 +1,4 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="Encoding" addBOMForNewFiles="with NO BOM" />
4
+</project>

+ 13
- 0
Checkbook/.idea/libraries/Maven__junit_junit_4_0.xml Datei anzeigen

@@ -0,0 +1,13 @@
1
+<component name="libraryTable">
2
+  <library name="Maven: junit:junit:4.0">
3
+    <CLASSES>
4
+      <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.0/junit-4.0.jar!/" />
5
+    </CLASSES>
6
+    <JAVADOC>
7
+      <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.0/junit-4.0-javadoc.jar!/" />
8
+    </JAVADOC>
9
+    <SOURCES>
10
+      <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.0/junit-4.0-sources.jar!/" />
11
+    </SOURCES>
12
+  </library>
13
+</component>

+ 13
- 0
Checkbook/.idea/misc.xml Datei anzeigen

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

+ 8
- 0
Checkbook/.idea/modules.xml Datei anzeigen

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

+ 6
- 0
Checkbook/.idea/vcs.xml Datei anzeigen

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

+ 343
- 0
Checkbook/.idea/workspace.xml Datei anzeigen

@@ -0,0 +1,343 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ChangeListManager">
4
+    <list default="true" id="86bea83e-ff28-4c08-8563-407f3ac4c927" name="Default Changelist" comment="">
5
+      <change beforePath="$PROJECT_DIR$/Checkbook.iml" beforeDir="false" />
6
+      <change beforePath="$PROJECT_DIR$/src/main/java/AccountBook.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/AccountBook.java" afterDir="false" />
7
+      <change beforePath="$PROJECT_DIR$/src/main/java/Checkbook.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/Checkbook.java" afterDir="false" />
8
+      <change beforePath="$PROJECT_DIR$/src/main/java/Transaction.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/Transaction.java" afterDir="false" />
9
+      <change beforePath="$PROJECT_DIR$/src/test/java/CheckbookTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/CheckbookTest.java" afterDir="false" />
10
+    </list>
11
+    <ignored path="$PROJECT_DIR$/target/" />
12
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
13
+    <option name="SHOW_DIALOG" value="false" />
14
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
15
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
16
+    <option name="LAST_RESOLUTION" value="IGNORE" />
17
+  </component>
18
+  <component name="FileEditorManager">
19
+    <leaf>
20
+      <file pinned="false" current-in-tab="false">
21
+        <entry file="file://$PROJECT_DIR$/src/main/java/AccountBook.java">
22
+          <provider selected="true" editor-type-id="text-editor">
23
+            <state relative-caret-position="46">
24
+              <caret line="2" column="10" selection-start-line="2" selection-start-column="10" selection-end-line="2" selection-end-column="10" />
25
+            </state>
26
+          </provider>
27
+        </entry>
28
+      </file>
29
+      <file pinned="false" current-in-tab="true">
30
+        <entry file="file://$PROJECT_DIR$/src/main/java/Checkbook.java">
31
+          <provider selected="true" editor-type-id="text-editor">
32
+            <state relative-caret-position="1311">
33
+              <caret line="57" column="5" selection-start-line="57" selection-start-column="5" selection-end-line="57" selection-end-column="5" />
34
+              <folding>
35
+                <element signature="e#224#225#0" expanded="true" />
36
+                <element signature="e#276#277#0" expanded="true" />
37
+                <element signature="e#478#479#0" expanded="true" />
38
+                <element signature="e#502#503#0" expanded="true" />
39
+                <element signature="e#548#549#0" expanded="true" />
40
+                <element signature="e#576#577#0" expanded="true" />
41
+                <element signature="e#723#724#0" expanded="true" />
42
+                <element signature="e#751#752#0" expanded="true" />
43
+                <element signature="e#821#822#0" expanded="true" />
44
+                <element signature="e#866#867#0" expanded="true" />
45
+                <element signature="e#799#800#0" expanded="true" />
46
+                <element signature="e#840#841#0" expanded="true" />
47
+                <element signature="e#1045#1046#0" expanded="true" />
48
+                <element signature="e#1069#1070#0" expanded="true" />
49
+                <element signature="e#1485#1486#0" expanded="true" />
50
+                <element signature="e#1600#1601#0" expanded="true" />
51
+                <element signature="e#1983#1984#0" expanded="true" />
52
+                <element signature="e#2094#2095#0" expanded="true" />
53
+                <element signature="e#2171#2172#0" expanded="true" />
54
+              </folding>
55
+            </state>
56
+          </provider>
57
+        </entry>
58
+      </file>
59
+      <file pinned="false" current-in-tab="false">
60
+        <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/src.zip!/java/util/ArrayList.java">
61
+          <provider selected="true" editor-type-id="text-editor">
62
+            <state relative-caret-position="-945">
63
+              <caret line="701" column="59" selection-start-line="701" selection-start-column="53" selection-end-line="701" selection-end-column="59" />
64
+            </state>
65
+          </provider>
66
+        </entry>
67
+      </file>
68
+      <file pinned="false" current-in-tab="false">
69
+        <entry file="file://$PROJECT_DIR$/src/main/java/GenericAccount.java">
70
+          <provider selected="true" editor-type-id="text-editor">
71
+            <state relative-caret-position="23">
72
+              <caret line="1" column="13" selection-start-line="1" selection-start-column="13" selection-end-line="1" selection-end-column="13" />
73
+            </state>
74
+          </provider>
75
+        </entry>
76
+      </file>
77
+      <file pinned="false" current-in-tab="false">
78
+        <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/src.zip!/java/util/Collection.java">
79
+          <provider selected="true" editor-type-id="text-editor">
80
+            <state relative-caret-position="187">
81
+              <caret line="143" column="17" selection-start-line="143" selection-start-column="17" selection-end-line="143" selection-end-column="17" />
82
+            </state>
83
+          </provider>
84
+        </entry>
85
+      </file>
86
+    </leaf>
87
+  </component>
88
+  <component name="FindInProjectRecents">
89
+    <findStrings>
90
+      <find>public</find>
91
+      <find>Student</find>
92
+      <find>toArray</find>
93
+      <find>remove</find>
94
+      <find>contains</find>
95
+      <find>retain</find>
96
+    </findStrings>
97
+  </component>
98
+  <component name="Git.Settings">
99
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
100
+    <option name="RECENT_BRANCH_BY_REPOSITORY">
101
+      <map>
102
+        <entry key="$PROJECT_DIR$/.." value="master" />
103
+      </map>
104
+    </option>
105
+  </component>
106
+  <component name="IdeDocumentHistory">
107
+    <option name="CHANGED_PATHS">
108
+      <list>
109
+        <option value="$PROJECT_DIR$/src/main/java/Transaction.java" />
110
+        <option value="$PROJECT_DIR$/src/main/java/AccountBook.java" />
111
+        <option value="$PROJECT_DIR$/src/test/java/CheckbookTest.java" />
112
+        <option value="$PROJECT_DIR$/src/main/java/Checkbook.java" />
113
+      </list>
114
+    </option>
115
+  </component>
116
+  <component name="ProjectFrameBounds" extendedState="6" fullScreen="true">
117
+    <option name="width" value="1440" />
118
+    <option name="height" value="900" />
119
+  </component>
120
+  <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
121
+  <component name="ProjectView">
122
+    <navigator proportions="" version="1">
123
+      <foldersAlwaysOnTop value="true" />
124
+    </navigator>
125
+    <panes>
126
+      <pane id="PackagesPane" />
127
+      <pane id="Scope" />
128
+      <pane id="ProjectPane">
129
+        <subPane>
130
+          <expand>
131
+            <path>
132
+              <item name="Checkbook" type="b2602c69:ProjectViewProjectNode" />
133
+              <item name="Checkbook" type="462c0819:PsiDirectoryNode" />
134
+            </path>
135
+            <path>
136
+              <item name="Checkbook" type="b2602c69:ProjectViewProjectNode" />
137
+              <item name="Checkbook" type="462c0819:PsiDirectoryNode" />
138
+              <item name="src" type="462c0819:PsiDirectoryNode" />
139
+            </path>
140
+            <path>
141
+              <item name="Checkbook" type="b2602c69:ProjectViewProjectNode" />
142
+              <item name="Checkbook" type="462c0819:PsiDirectoryNode" />
143
+              <item name="src" type="462c0819:PsiDirectoryNode" />
144
+              <item name="main" type="462c0819:PsiDirectoryNode" />
145
+            </path>
146
+            <path>
147
+              <item name="Checkbook" type="b2602c69:ProjectViewProjectNode" />
148
+              <item name="Checkbook" type="462c0819:PsiDirectoryNode" />
149
+              <item name="src" type="462c0819:PsiDirectoryNode" />
150
+              <item name="main" type="462c0819:PsiDirectoryNode" />
151
+              <item name="java" type="462c0819:PsiDirectoryNode" />
152
+            </path>
153
+            <path>
154
+              <item name="Checkbook" type="b2602c69:ProjectViewProjectNode" />
155
+              <item name="Checkbook" type="462c0819:PsiDirectoryNode" />
156
+              <item name="src" type="462c0819:PsiDirectoryNode" />
157
+              <item name="test" type="462c0819:PsiDirectoryNode" />
158
+            </path>
159
+            <path>
160
+              <item name="Checkbook" type="b2602c69:ProjectViewProjectNode" />
161
+              <item name="Checkbook" type="462c0819:PsiDirectoryNode" />
162
+              <item name="src" type="462c0819:PsiDirectoryNode" />
163
+              <item name="test" type="462c0819:PsiDirectoryNode" />
164
+              <item name="java" type="462c0819:PsiDirectoryNode" />
165
+            </path>
166
+          </expand>
167
+          <select />
168
+        </subPane>
169
+      </pane>
170
+    </panes>
171
+  </component>
172
+  <component name="PropertiesComponent">
173
+    <property name="WebServerToolWindowFactoryState" value="false" />
174
+    <property name="aspect.path.notification.shown" value="true" />
175
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1544213381725" />
176
+    <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
177
+    <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrarySuperClass.JUnit4" value="" />
178
+    <property name="extract.method.default.visibility" value="private" />
179
+    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
180
+    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
181
+  </component>
182
+  <component name="RecentsManager">
183
+    <key name="CreateTestDialog.RecentsKey">
184
+      <recent name="" />
185
+    </key>
186
+    <key name="CreateTestDialog.Recents.Supers">
187
+      <recent name="" />
188
+    </key>
189
+  </component>
190
+  <component name="RunDashboard">
191
+    <option name="ruleStates">
192
+      <list>
193
+        <RuleState>
194
+          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
195
+        </RuleState>
196
+        <RuleState>
197
+          <option name="name" value="StatusDashboardGroupingRule" />
198
+        </RuleState>
199
+      </list>
200
+    </option>
201
+  </component>
202
+  <component name="SvnConfiguration">
203
+    <configuration />
204
+  </component>
205
+  <component name="TaskManager">
206
+    <task active="true" id="Default" summary="Default task">
207
+      <changelist id="86bea83e-ff28-4c08-8563-407f3ac4c927" name="Default Changelist" comment="" />
208
+      <created>1544199126934</created>
209
+      <option name="number" value="Default" />
210
+      <option name="presentableId" value="Default" />
211
+      <updated>1544199126934</updated>
212
+      <workItem from="1544199128297" duration="10136000" />
213
+    </task>
214
+    <servers />
215
+  </component>
216
+  <component name="TimeTrackingManager">
217
+    <option name="totallyTimeSpent" value="10136000" />
218
+  </component>
219
+  <component name="ToolWindowManager">
220
+    <frame x="0" y="0" width="904" height="900" extended-state="6" />
221
+    <editor active="true" />
222
+    <layout>
223
+      <window_info id="Favorites" side_tool="true" />
224
+      <window_info id="Image Layers" />
225
+      <window_info id="Designer" />
226
+      <window_info id="UI Designer" />
227
+      <window_info id="Capture Tool" />
228
+      <window_info id="Learn" />
229
+      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.26218098" />
230
+      <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
231
+      <window_info anchor="bottom" id="Docker" show_stripe_button="false" />
232
+      <window_info anchor="bottom" id="Version Control" />
233
+      <window_info anchor="bottom" id="Terminal" />
234
+      <window_info anchor="bottom" id="Event Log" side_tool="true" />
235
+      <window_info anchor="bottom" id="Database Changes" />
236
+      <window_info anchor="bottom" id="Message" order="0" />
237
+      <window_info anchor="bottom" id="Find" order="1" />
238
+      <window_info anchor="bottom" id="Run" order="2" />
239
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
240
+      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
241
+      <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
242
+      <window_info anchor="bottom" id="TODO" order="6" />
243
+      <window_info anchor="right" id="Palette" />
244
+      <window_info anchor="right" id="Theme Preview" />
245
+      <window_info anchor="right" id="Maven" />
246
+      <window_info anchor="right" id="Capture Analysis" />
247
+      <window_info anchor="right" id="Palette&#9;" />
248
+      <window_info anchor="right" id="Database" />
249
+      <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
250
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
251
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
252
+    </layout>
253
+  </component>
254
+  <component name="TypeScriptGeneratedFilesManager">
255
+    <option name="version" value="1" />
256
+  </component>
257
+  <component name="editorHistoryManager">
258
+    <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/src.zip!/java/util/Collection.java">
259
+      <provider selected="true" editor-type-id="text-editor">
260
+        <state relative-caret-position="187">
261
+          <caret line="143" column="17" selection-start-line="143" selection-start-column="17" selection-end-line="143" selection-end-column="17" />
262
+        </state>
263
+      </provider>
264
+    </entry>
265
+    <entry file="file://$PROJECT_DIR$/src/main/java/AccountBook.java">
266
+      <provider selected="true" editor-type-id="text-editor">
267
+        <state relative-caret-position="46">
268
+          <caret line="2" column="10" selection-start-line="2" selection-start-column="10" selection-end-line="2" selection-end-column="10" />
269
+        </state>
270
+      </provider>
271
+    </entry>
272
+    <entry file="file://$PROJECT_DIR$/src/main/java/Transaction.java">
273
+      <provider selected="true" editor-type-id="text-editor">
274
+        <state relative-caret-position="299">
275
+          <caret line="14" column="27" lean-forward="true" selection-start-line="14" selection-start-column="27" selection-end-line="14" selection-end-column="27" />
276
+        </state>
277
+      </provider>
278
+    </entry>
279
+    <entry file="file://$PROJECT_DIR$/src/main/java/Payee.java">
280
+      <provider selected="true" editor-type-id="text-editor">
281
+        <state>
282
+          <caret column="13" selection-start-column="13" selection-end-column="13" />
283
+        </state>
284
+      </provider>
285
+    </entry>
286
+    <entry file="file://$PROJECT_DIR$/src/main/java/TransactionType.java">
287
+      <provider selected="true" editor-type-id="text-editor">
288
+        <state relative-caret-position="23">
289
+          <caret line="1" column="12" selection-start-line="1" selection-start-column="12" selection-end-line="1" selection-end-column="12" />
290
+        </state>
291
+      </provider>
292
+    </entry>
293
+    <entry file="file://$PROJECT_DIR$/src/test/java/CheckbookTest.java">
294
+      <provider selected="true" editor-type-id="text-editor">
295
+        <state relative-caret-position="593">
296
+          <caret line="64" column="5" selection-start-line="64" selection-start-column="5" selection-end-line="64" selection-end-column="5" />
297
+        </state>
298
+      </provider>
299
+    </entry>
300
+    <entry file="file://$PROJECT_DIR$/src/main/java/GenericAccount.java">
301
+      <provider selected="true" editor-type-id="text-editor">
302
+        <state relative-caret-position="23">
303
+          <caret line="1" column="13" selection-start-line="1" selection-start-column="13" selection-end-line="1" selection-end-column="13" />
304
+        </state>
305
+      </provider>
306
+    </entry>
307
+    <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/src.zip!/java/util/ArrayList.java">
308
+      <provider selected="true" editor-type-id="text-editor">
309
+        <state relative-caret-position="-945">
310
+          <caret line="701" column="59" selection-start-line="701" selection-start-column="53" selection-end-line="701" selection-end-column="59" />
311
+        </state>
312
+      </provider>
313
+    </entry>
314
+    <entry file="file://$PROJECT_DIR$/src/main/java/Checkbook.java">
315
+      <provider selected="true" editor-type-id="text-editor">
316
+        <state relative-caret-position="1311">
317
+          <caret line="57" column="5" selection-start-line="57" selection-start-column="5" selection-end-line="57" selection-end-column="5" />
318
+          <folding>
319
+            <element signature="e#224#225#0" expanded="true" />
320
+            <element signature="e#276#277#0" expanded="true" />
321
+            <element signature="e#478#479#0" expanded="true" />
322
+            <element signature="e#502#503#0" expanded="true" />
323
+            <element signature="e#548#549#0" expanded="true" />
324
+            <element signature="e#576#577#0" expanded="true" />
325
+            <element signature="e#723#724#0" expanded="true" />
326
+            <element signature="e#751#752#0" expanded="true" />
327
+            <element signature="e#821#822#0" expanded="true" />
328
+            <element signature="e#866#867#0" expanded="true" />
329
+            <element signature="e#799#800#0" expanded="true" />
330
+            <element signature="e#840#841#0" expanded="true" />
331
+            <element signature="e#1045#1046#0" expanded="true" />
332
+            <element signature="e#1069#1070#0" expanded="true" />
333
+            <element signature="e#1485#1486#0" expanded="true" />
334
+            <element signature="e#1600#1601#0" expanded="true" />
335
+            <element signature="e#1983#1984#0" expanded="true" />
336
+            <element signature="e#2094#2095#0" expanded="true" />
337
+            <element signature="e#2171#2172#0" expanded="true" />
338
+          </folding>
339
+        </state>
340
+      </provider>
341
+    </entry>
342
+  </component>
343
+</project>

+ 1
- 2
Checkbook/Checkbook.iml Datei anzeigen

@@ -5,11 +5,10 @@
5 5
     <output-test url="file://$MODULE_DIR$/target/test-classes" />
6 6
     <content url="file://$MODULE_DIR$">
7 7
       <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8
-      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
9 8
       <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
10 9
       <excludeFolder url="file://$MODULE_DIR$/target" />
11 10
     </content>
12
-    <orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
11
+    <orderEntry type="inheritedJdk" />
13 12
     <orderEntry type="sourceFolder" forTests="false" />
14 13
     <orderEntry type="library" name="Maven: junit:junit:4.0" level="project" />
15 14
   </component>

+ 9
- 9
Checkbook/src/main/java/AccountBook.java Datei anzeigen

@@ -1,12 +1,12 @@
1 1
 import java.time.LocalDate;
2 2
 
3
-public interface AccountBook {
4
-    public Integer getId();
5
-    public LocalDate getDate();
6
-    public TransactionType getType();
7
-    public String getMemo() ;
8
-    public void setMemo(String memo);
9
-    public Payee getPayee();
10
-    public void setPayee(Payee payee);
11
-    public Double getAmount();
3
+interface AccountBook {
4
+    Integer getId();
5
+    LocalDate getDate();
6
+    TransactionType getType();
7
+    String getMemo() ;
8
+    void setMemo(String memo);
9
+    Payee getPayee();
10
+    void setPayee(Payee payee);
11
+    Double getAmount();
12 12
 }

+ 89
- 1
Checkbook/src/main/java/Checkbook.java Datei anzeigen

@@ -1,4 +1,92 @@
1
-public class Checkbook {
1
+import java.util.*;
2
+
3
+public class Checkbook<T extends Transaction> implements Collection<T> {
4
+    private ArrayList<Transaction> transactions;
5
+    private final int CHECKBOOK_SIZE = 100;
6
+
7
+    private Payee owner;
8
+    private double cashAmount;
9
+
10
+    public Checkbook() {
11
+        this.transactions = new ArrayList<>();
12
+    }
13
+
14
+    public Checkbook(double cashAmount) {
15
+        this();
16
+        this.cashAmount = cashAmount;
17
+    }
18
+
19
+    public Checkbook(Payee owner, double cashAmount) {
20
+        this(cashAmount);
21
+        this.owner = owner;
22
+    }
23
+
24
+    @Override
25
+    public int size() {
26
+        return transactions.size();
27
+    }
28
+
29
+    @Override
30
+    public boolean isEmpty() {
31
+        return transactions.isEmpty();
32
+    }
33
+
34
+    @Override
35
+    public boolean contains(Object t) {
36
+        return transactions.contains(t);
37
+    }
38
+
39
+    @Override
40
+    public Iterator<T> iterator() {
41
+        return (Iterator<T>) transactions.iterator();
42
+    }
43
+
44
+    @Override
45
+    public Transaction[] toArray() {
46
+        return (Transaction[]) transactions.toArray();
47
+    }
48
+
49
+    @Override
50
+    public <T> T[] toArray(T[] a) {
51
+        return transactions.toArray(a);
52
+    }
53
+
54
+    @Override
55
+    public boolean add(Transaction transaction) {
56
+        if (size() <= CHECKBOOK_SIZE) { return transactions.add(transaction); }
57
+        else throw new IndexOutOfBoundsException("Check limit exceeded. You need a new checkbook!");
58
+    }
59
+
60
+    @Override
61
+    public boolean remove(Object o) {
62
+        return transactions.remove(o);
63
+    }
64
+
65
+    @Override
66
+    public boolean containsAll(Collection<?> c) {
67
+        return transactions.containsAll(c);
68
+    }
69
+
70
+    @Override
71
+    public boolean addAll(Collection<? extends T> c) {
72
+        if (size() + c.size() <= CHECKBOOK_SIZE) { return transactions.addAll(c); }
73
+        else throw new IndexOutOfBoundsException("You do not have enough checks available in your checkbook.");
74
+    }
75
+
76
+    @Override
77
+    public boolean removeAll(Collection<?> c) {
78
+        return transactions.removeAll(c);
79
+    }
80
+
81
+    @Override
82
+    public boolean retainAll(Collection<?> c) {
83
+        return transactions.retainAll(c);
84
+    }
85
+
86
+    @Override
87
+    public void clear() {
88
+        transactions.clear();
89
+    }
2 90
 
3 91
     //blind us with your Java eloquence....
4 92
 

+ 1
- 1
Checkbook/src/main/java/GenericAccount.java Datei anzeigen

@@ -1,3 +1,3 @@
1 1
 
2
-public class GenericAccount {
2
+public class GenericAccount<A extends AccountBook> {
3 3
 }

+ 5
- 5
Checkbook/src/main/java/Transaction.java Datei anzeigen

@@ -6,11 +6,11 @@ public class Transaction {
6 6
     private final AtomicReference<LocalDate> date = new AtomicReference<LocalDate>();
7 7
     private String memo;
8 8
     private Payee payee;
9
-    private TransactionType typee; // Credit (reduces the checkbook), Debit (increases the checkbook)
9
+    private TransactionType type; // Credit (reduces the checkbook), Debit (increases the checkbook)
10 10
     private Double amount;
11 11
 
12
-    public Transaction(String memo, Payee payee, TransactionType typee, Double amount) {
13
-        this.typee = typee;
12
+    public Transaction(String memo, Payee payee, TransactionType type, Double amount) {
13
+        this.type = type;
14 14
         this.memo = memo;
15 15
         this.payee = payee;
16 16
         this.amount = amount;
@@ -25,7 +25,7 @@ public class Transaction {
25 25
     }
26 26
 
27 27
     public TransactionType getType() {
28
-        return typee;
28
+        return type;
29 29
     }
30 30
 
31 31
     public String getMemo() {
@@ -45,7 +45,7 @@ public class Transaction {
45 45
     }
46 46
 
47 47
     public Double getAmount() {
48
-        if (this.typee == TransactionType.DEBIT) {
48
+        if (this.type == TransactionType.DEBIT) {
49 49
             return amount;
50 50
         }
51 51
         return (-1.0 * amount);

+ 54
- 0
Checkbook/src/test/java/CheckbookTest.java Datei anzeigen

@@ -1,3 +1,5 @@
1
+import org.junit.Test;
2
+
1 3
 import static org.junit.Assert.*;
2 4
 
3 5
 public class CheckbookTest {
@@ -9,4 +11,56 @@ public class CheckbookTest {
9 11
     @org.junit.After
10 12
     public void tearDown() throws Exception {
11 13
     }
14
+
15
+    @Test
16
+    public void size() {
17
+    }
18
+
19
+    @Test
20
+    public void isEmpty() {
21
+    }
22
+
23
+    @Test
24
+    public void contains() {
25
+    }
26
+
27
+    @Test
28
+    public void iterator() {
29
+    }
30
+
31
+    @Test
32
+    public void toArray() {
33
+    }
34
+
35
+    @Test
36
+    public void toArray1() {
37
+    }
38
+
39
+    @Test
40
+    public void add() {
41
+    }
42
+
43
+    @Test
44
+    public void remove() {
45
+    }
46
+
47
+    @Test
48
+    public void containsAll() {
49
+    }
50
+
51
+    @Test
52
+    public void addAll() {
53
+    }
54
+
55
+    @Test
56
+    public void removeAll() {
57
+    }
58
+
59
+    @Test
60
+    public void retainAll() {
61
+    }
62
+
63
+    @Test
64
+    public void clear() {
65
+    }
12 66
 }