Bladeren bron

interim update

donnaj 6 jaren geleden
bovenliggende
commit
189a4d567c
3 gewijzigde bestanden met toevoegingen van 50 en 26 verwijderingen
  1. 44
    20
      Inventory.java
  2. 0
    0
      README.TXT
  3. 6
    6
      package.bluej

+ 44
- 20
Inventory.java Bestand weergeven

10
     public void updateQuality() {
10
     public void updateQuality() {
11
         for (int i = 0; i < items.length; i++) {
11
         for (int i = 0; i < items.length; i++) {
12
             if (!items[i].getName().equals("Aged Brie")) {
12
             if (!items[i].getName().equals("Aged Brie")) {
13
-                if (items[i].getQuality() > 0) {
14
-                    if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
15
-                        items[i].setQuality(items[i].getQuality() - 1);
16
-                    }
17
-                }
18
-            } else {
19
-                if (items[i].getQuality() < 50) {
20
-                    items[i].setQuality(items[i].getQuality() + 1);
21
-                }
13
+                regItemUpdate();
14
+                // if (items[i].getQuality() > 0) {
15
+                    // if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
16
+                        // items[i].setQuality(items[i].getQuality() - 1);
17
+                    // }
18
+                // }
19
+            } else {agedBrieUpdate();
20
+                // if (items[i].getQuality() < 50) {
21
+                    // items[i].setQuality(items[i].getQuality() + 1);
22
+                // }
22
             }
23
             }
24
+            
23
 
25
 
24
             if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
26
             if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
25
-                items[i].setSellIn(items[i].getSellIn() - 1);
27
+                // items[i].setSellIn(items[i].getSellIn() - 1);
28
+                continue;
26
             }
29
             }
27
 
30
 
28
-            if (items[i].getSellIn() < 0) {
29
-                if (!items[i].getName().equals("Aged Brie")) {
30
-                  items[i].setQuality(items[i].getQuality() - 1);
31
-                } else {
32
-                    if (items[i].getQuality() < 50) {
33
-                        items[i].setQuality(items[i].getQuality() + 1);
34
-                    }
35
-                }
36
-            }
31
+            // if (items[i].getSellIn() < 0) {
32
+                // if (!items[i].getName().equals("Aged Brie")) {
33
+                  // items[i].setQuality(items[i].getQuality() - 1);
34
+                // } else {
35
+                    // if (items[i].getQuality() < 50) {
36
+                        // items[i].setQuality(items[i].getQuality() + 1);
37
+                    // }
38
+                // }
39
+            // }
37
         }
40
         }
38
-}
41
+    }
42
+
43
+    public void agedBrieUpdate() {
44
+        int i = 0;
45
+        if (items[i].getSellIn() > 0 && items[i].getQuality() <=49) {
46
+	items[i].setQuality(items[i].getQuality() + 1);
47
+	} else if (items[i].getSellIn() < 0 && items[i].getQuality() <= 48){
48
+	    items[i].setQuality(items[i].getQuality() + 2);	
49
+	   }
50
+
51
+    }
52
+    
53
+    public void regItemUpdate() {
54
+        int i = 0;
55
+        if (items[i].getSellIn() > 0) {
56
+	items[i].setQuality(items[i].getQuality() - 1);
57
+	} else if (items[i].getSellIn() < 0){
58
+	    items[i].setQuality(items[i].getQuality() - 2);	
59
+	   }
60
+
61
+    }
62
+
39
 }
63
 }

+ 0
- 0
README.TXT Bestand weergeven


+ 6
- 6
package.bluej Bestand weergeven

5
 dependency2.from=InventoryTest
5
 dependency2.from=InventoryTest
6
 dependency2.to=Inventory
6
 dependency2.to=Inventory
7
 dependency2.type=UsesDependency
7
 dependency2.type=UsesDependency
8
-editor.fx.0.height=722
8
+editor.fx.0.height=712
9
 editor.fx.0.width=800
9
 editor.fx.0.width=800
10
 editor.fx.0.x=320
10
 editor.fx.0.x=320
11
-editor.fx.0.y=50
11
+editor.fx.0.y=23
12
 objectbench.height=164
12
 objectbench.height=164
13
-objectbench.width=776
13
+objectbench.width=461
14
 package.divider.horizontal=0.6
14
 package.divider.horizontal=0.6
15
 package.divider.vertical=0.6845018450184502
15
 package.divider.vertical=0.6845018450184502
16
 package.editor.height=364
16
 package.editor.height=364
17
 package.editor.width=674
17
 package.editor.width=674
18
-package.editor.x=577
18
+package.editor.x=480
19
 package.editor.y=61
19
 package.editor.y=61
20
 package.frame.height=600
20
 package.frame.height=600
21
 package.frame.width=800
21
 package.frame.width=800
34
 target1.showInterface=false
34
 target1.showInterface=false
35
 target1.type=ClassTarget
35
 target1.type=ClassTarget
36
 target1.width=80
36
 target1.width=80
37
-target1.x=10
38
-target1.y=100
37
+target1.x=30
38
+target1.y=90
39
 target2.height=50
39
 target2.height=50
40
 target2.name=InventoryTest
40
 target2.name=InventoryTest
41
 target2.showInterface=false
41
 target2.showInterface=false