Kr Younger 6 yıl önce
ebeveyn
işleme
f6a9f242cb

+ 55
- 87
.idea/workspace.xml Dosyayı Görüntüle

@@ -2,12 +2,12 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="926ad23d-2ddc-41ae-980d-780dcc1811fa" name="Default" comment="">
5
-      <change beforePath="" afterPath="$PROJECT_DIR$/Checkbook/pom.xml" />
6
-      <change beforePath="" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java" />
7
-      <change beforePath="" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/Payee.java" />
8
-      <change beforePath="" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java" />
9
-      <change beforePath="" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java" />
10
-      <change beforePath="" afterPath="$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java" />
5
+      <change beforePath="" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/AccountBook.java" />
6
+      <change beforePath="" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/GenericAccount.java" />
7
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
8
+      <change beforePath="$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java" />
9
+      <change beforePath="$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java" />
10
+      <change beforePath="$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java" />
11 11
       <change beforePath="$PROJECT_DIR$/README.md" afterPath="$PROJECT_DIR$/README.md" />
12 12
     </list>
13 13
     <ignored path="$PROJECT_DIR$/Checkbook/target/" />
@@ -20,32 +20,12 @@
20 20
   </component>
21 21
   <component name="FileEditorManager">
22 22
     <leaf>
23
-      <file leaf-file-name="pom.xml" pinned="false" current-in-tab="false">
24
-        <entry file="file://$PROJECT_DIR$/Checkbook/pom.xml">
25
-          <provider selected="true" editor-type-id="text-editor">
26
-            <state relative-caret-position="0">
27
-              <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
28
-              <folding />
29
-            </state>
30
-          </provider>
31
-        </entry>
32
-      </file>
33
-      <file leaf-file-name="Checkbook.java" pinned="false" current-in-tab="false">
34
-        <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java">
35
-          <provider selected="true" editor-type-id="text-editor">
36
-            <state relative-caret-position="0">
37
-              <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
38
-              <folding />
39
-            </state>
40
-          </provider>
41
-        </entry>
42
-      </file>
43 23
       <file leaf-file-name="README.md" pinned="false" current-in-tab="true">
44 24
         <entry file="file://$PROJECT_DIR$/README.md">
45 25
           <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
46 26
             <state split_layout="SPLIT">
47
-              <first_editor relative-caret-position="527">
48
-                <caret line="31" column="21" lean-forward="false" selection-start-line="31" selection-start-column="21" selection-end-line="31" selection-end-column="21" />
27
+              <first_editor relative-caret-position="443">
28
+                <caret line="31" column="29" lean-forward="false" selection-start-line="31" selection-start-column="29" selection-end-line="31" selection-end-column="29" />
49 29
                 <folding />
50 30
               </first_editor>
51 31
               <second_editor />
@@ -53,41 +33,6 @@
53 33
           </provider>
54 34
         </entry>
55 35
       </file>
56
-      <file leaf-file-name="Transaction.java" pinned="false" current-in-tab="false">
57
-        <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java">
58
-          <provider selected="true" editor-type-id="text-editor">
59
-            <state relative-caret-position="85">
60
-              <caret line="5" column="81" lean-forward="false" selection-start-line="5" selection-start-column="72" selection-end-line="5" selection-end-column="81" />
61
-              <folding>
62
-                <element signature="imports" expanded="true" />
63
-                <element signature="e#175#184#0" expanded="true" />
64
-                <element signature="e#661#662#0" expanded="true" />
65
-                <element signature="e#692#693#0" expanded="true" />
66
-                <element signature="e#726#727#0" expanded="true" />
67
-                <element signature="e#759#760#0" expanded="true" />
68
-                <element signature="e#790#791#0" expanded="true" />
69
-                <element signature="e#817#818#0" expanded="true" />
70
-                <element signature="e#857#858#0" expanded="true" />
71
-                <element signature="e#889#890#0" expanded="true" />
72
-                <element signature="e#920#921#0" expanded="true" />
73
-                <element signature="e#948#949#0" expanded="true" />
74
-                <element signature="e#989#990#0" expanded="true" />
75
-                <element signature="e#1023#1024#0" expanded="true" />
76
-              </folding>
77
-            </state>
78
-          </provider>
79
-        </entry>
80
-      </file>
81
-      <file leaf-file-name="TransactionType.java" pinned="false" current-in-tab="false">
82
-        <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java">
83
-          <provider selected="true" editor-type-id="text-editor">
84
-            <state relative-caret-position="0">
85
-              <caret line="0" column="27" lean-forward="false" selection-start-line="0" selection-start-column="12" selection-end-line="0" selection-end-column="27" />
86
-              <folding />
87
-            </state>
88
-          </provider>
89
-        </entry>
90
-      </file>
91 36
     </leaf>
92 37
   </component>
93 38
   <component name="FileTemplateManagerImpl">
@@ -95,6 +40,7 @@
95 40
       <list>
96 41
         <option value="JUnit4 Test Class" />
97 42
         <option value="Class" />
43
+        <option value="Interface" />
98 44
       </list>
99 45
     </option>
100 46
   </component>
@@ -116,8 +62,11 @@
116 62
       <list>
117 63
         <option value="$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java" />
118 64
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/Payee.java" />
119
-        <option value="$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java" />
120 65
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java" />
66
+        <option value="$PROJECT_DIR$/Checkbook/src/main/java/AccountBook.java" />
67
+        <option value="$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java" />
68
+        <option value="$PROJECT_DIR$/Checkbook/src/main/java/GenericAccount.java" />
69
+        <option value="$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java" />
121 70
         <option value="$PROJECT_DIR$/README.md" />
122 71
       </list>
123 72
     </option>
@@ -319,12 +268,12 @@
319 268
       <option name="number" value="Default" />
320 269
       <option name="presentableId" value="Default" />
321 270
       <updated>1543958631974</updated>
322
-      <workItem from="1543958633447" duration="2457000" />
271
+      <workItem from="1543958633447" duration="2990000" />
323 272
     </task>
324 273
     <servers />
325 274
   </component>
326 275
   <component name="TimeTrackingManager">
327
-    <option name="totallyTimeSpent" value="2457000" />
276
+    <option name="totallyTimeSpent" value="2990000" />
328 277
   </component>
329 278
   <component name="ToolWindowManager">
330 279
     <frame x="91" y="61" width="1538" height="962" extended-state="0" />
@@ -406,47 +355,66 @@
406 355
         </state>
407 356
       </provider>
408 357
     </entry>
409
-    <entry file="file://$PROJECT_DIR$/Checkbook/pom.xml">
358
+    <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/GenericAccount.java">
410 359
       <provider selected="true" editor-type-id="text-editor">
411
-        <state relative-caret-position="0">
412
-          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
360
+        <state relative-caret-position="17">
361
+          <caret line="1" column="0" lean-forward="false" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
413 362
           <folding />
414 363
         </state>
415 364
       </provider>
416 365
     </entry>
417 366
     <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java">
418 367
       <provider selected="true" editor-type-id="text-editor">
419
-        <state relative-caret-position="0">
420
-          <caret line="0" column="27" lean-forward="false" selection-start-line="0" selection-start-column="12" selection-end-line="0" selection-end-column="27" />
368
+        <state relative-caret-position="17">
369
+          <caret line="1" column="0" lean-forward="false" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
421 370
           <folding />
422 371
         </state>
423 372
       </provider>
424 373
     </entry>
425 374
     <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java">
426 375
       <provider selected="true" editor-type-id="text-editor">
427
-        <state relative-caret-position="85">
428
-          <caret line="5" column="81" lean-forward="false" selection-start-line="5" selection-start-column="72" selection-end-line="5" selection-end-column="81" />
376
+        <state relative-caret-position="442">
377
+          <caret line="26" column="18" lean-forward="true" selection-start-line="26" selection-start-column="0" selection-end-line="27" selection-end-column="0" />
429 378
           <folding>
430 379
             <element signature="imports" expanded="true" />
431 380
             <element signature="e#175#184#0" expanded="true" />
432
-            <element signature="e#661#662#0" expanded="true" />
433
-            <element signature="e#692#693#0" expanded="true" />
434
-            <element signature="e#726#727#0" expanded="true" />
435
-            <element signature="e#759#760#0" expanded="true" />
436
-            <element signature="e#790#791#0" expanded="true" />
437
-            <element signature="e#817#818#0" expanded="true" />
438
-            <element signature="e#857#858#0" expanded="true" />
439
-            <element signature="e#889#890#0" expanded="true" />
440
-            <element signature="e#920#921#0" expanded="true" />
441
-            <element signature="e#948#949#0" expanded="true" />
442
-            <element signature="e#989#990#0" expanded="true" />
443
-            <element signature="e#1023#1024#0" expanded="true" />
381
+            <element signature="e#259#270#0" expanded="true" />
382
+            <element signature="e#689#690#0" expanded="true" />
383
+            <element signature="e#720#721#0" expanded="true" />
384
+            <element signature="e#754#755#0" expanded="true" />
385
+            <element signature="e#787#788#0" expanded="true" />
386
+            <element signature="e#827#828#0" expanded="true" />
387
+            <element signature="e#855#856#0" expanded="true" />
388
+            <element signature="e#886#887#0" expanded="true" />
389
+            <element signature="e#913#914#0" expanded="true" />
390
+            <element signature="e#953#954#0" expanded="true" />
391
+            <element signature="e#985#986#0" expanded="true" />
392
+            <element signature="e#1016#1017#0" expanded="true" />
393
+            <element signature="e#1044#1045#0" expanded="true" />
394
+            <element signature="e#1085#1086#0" expanded="true" />
395
+            <element signature="e#1119#1120#0" expanded="true" />
444 396
           </folding>
445 397
         </state>
446 398
       </provider>
447 399
     </entry>
400
+    <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/AccountBook.java">
401
+      <provider selected="true" editor-type-id="text-editor">
402
+        <state relative-caret-position="204">
403
+          <caret line="12" column="0" lean-forward="true" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="0" />
404
+          <folding />
405
+        </state>
406
+      </provider>
407
+    </entry>
448 408
     <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java">
449 409
       <provider selected="true" editor-type-id="text-editor">
410
+        <state relative-caret-position="51">
411
+          <caret line="3" column="0" lean-forward="false" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
412
+          <folding />
413
+        </state>
414
+      </provider>
415
+    </entry>
416
+    <entry file="file://$PROJECT_DIR$/Checkbook/pom.xml">
417
+      <provider selected="true" editor-type-id="text-editor">
450 418
         <state relative-caret-position="0">
451 419
           <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
452 420
           <folding />
@@ -456,8 +424,8 @@
456 424
     <entry file="file://$PROJECT_DIR$/README.md">
457 425
       <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
458 426
         <state split_layout="SPLIT">
459
-          <first_editor relative-caret-position="527">
460
-            <caret line="31" column="21" lean-forward="false" selection-start-line="31" selection-start-column="21" selection-end-line="31" selection-end-column="21" />
427
+          <first_editor relative-caret-position="443">
428
+            <caret line="31" column="29" lean-forward="false" selection-start-line="31" selection-start-column="29" selection-end-line="31" selection-end-column="29" />
461 429
             <folding />
462 430
           </first_editor>
463 431
           <second_editor />

+ 12
- 0
Checkbook/src/main/java/AccountBook.java Dosyayı Görüntüle

@@ -0,0 +1,12 @@
1
+import java.time.LocalDate;
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();
12
+}

+ 3
- 0
Checkbook/src/main/java/Checkbook.java Dosyayı Görüntüle

@@ -1,2 +1,5 @@
1 1
 public class Checkbook {
2
+
3
+    //blind us with your Java eloquence....
4
+
2 5
 }

+ 3
- 0
Checkbook/src/main/java/GenericAccount.java Dosyayı Görüntüle

@@ -0,0 +1,3 @@
1
+
2
+public class GenericAccount {
3
+}

+ 5
- 0
Checkbook/src/main/java/Transaction.java Dosyayı Görüntüle

@@ -10,6 +10,7 @@ public class Transaction {
10 10
     private Double amount;
11 11
 
12 12
     public Transaction(String memo, Payee payee, TransactionType typee, Double amount) {
13
+        this.typee = typee;
13 14
         this.memo = memo;
14 15
         this.payee = payee;
15 16
         this.amount = amount;
@@ -23,6 +24,10 @@ public class Transaction {
23 24
         return date.get();
24 25
     }
25 26
 
27
+    public TransactionType getType() {
28
+        return typee;
29
+    }
30
+
26 31
     public String getMemo() {
27 32
         return memo;
28 33
     }

+ 1
- 0
Checkbook/src/main/java/TransactionType.java Dosyayı Görüntüle

@@ -1,3 +1,4 @@
1
+
1 2
 public enum TransactionType {
2 3
     DEBIT,
3 4
     CREDIT;

+ 4
- 0
README.md Dosyayı Görüntüle

@@ -28,6 +28,8 @@ Checkbook
28 28
  * double checkbookValue() // sum of all Transactions (both Debits and Credits)
29 29
  * Transaction getTransactionsForDate(LocalDate aDate)
30 30
  * Transaction[] getAllTransactionsForPayee(Payee payee)
31
+ * Transaction[] getAllDebitTransactions()
32
+ * Transaction[] getAllCreditTransactions()
31 33
  
32 34
  Special Constructors:
33 35
  * Checkbook(double cashAmount)
@@ -40,3 +42,5 @@ Checkbook
40 42
  * boolean addAll(Collection<Transaction> c)
41 43
  * boolean removeAll(Collection<Transaction> c)
42 44
  * void clear()
45
+
46
+finally, make a generic account class, that takes any class which implements the AccountBook interface.