2 Revīzijas

Autors SHA1 Ziņojums Datums
  donnaj bff649df8b complete 6 gadus atpakaļ
  donnaj 189a4d567c interim update 6 gadus atpakaļ
3 mainītis faili ar 56 papildinājumiem un 28 dzēšanām
  1. 49
    21
      Inventory.java
  2. 0
    0
      README.TXT
  3. 7
    7
      package.bluej

+ 49
- 21
Inventory.java Parādīt failu

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

+ 0
- 0
README.TXT Parādīt failu


+ 7
- 7
package.bluej Parādīt failu

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