package com.gildedrose;

class GildedRose {
    Item[] items;

    public GildedRose(Item[] items) {
        this.items = items;
    }

    private void decreaseQuality(Item item) {
        if (item.quality <= 0) return; 
        item.quality--;
    }

    private void increaseQuality(Item item) {
        if (item.quality >= 50) return; 
        item.quality++;
    }
    
    public void updateQuality() {
        for (int i = 0; i < items.length; i++) {
            if (!items[i].name.equals("Aged Brie")
                    && !items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
                if (items[i].quality > 0) {
                    if (items[i].name.equals("Sulfuras, Hand of Ragnaros")) {

                    } else {
                        decreaseQuality(items[i]);
                    }
                }
            } else {
            		increaseQuality(items[i]);
            }

            if (items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
                if (items[i].sellIn < 11) {
            			increaseQuality(items[i]);
                }
                if (items[i].sellIn < 6) {
            			increaseQuality(items[i]);
                }
            }
            
            if (items[i].name.equals("Sulfuras, Hand of Ragnaros")) {

            } else {
                items[i].sellIn--;
            }

            if (items[i].sellIn < 0) {
                if (!items[i].name.equals("Aged Brie")) {
                    if (!items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
                        if (items[i].quality > 0) {
                            if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
	                            decreaseQuality(items[i]);
                            }
                        }
                    } else {
                        items[i].quality = 0;
                    }
                } else {
            			increaseQuality(items[i]);
                }
            }
        }
    }
}

@@ -467,79 +467,108 @@
     
-if (!items%5Bi%5D.name.equals(%22Aged Brie%22)%0A                    && !items%5Bi%5D
+Item currentItem = items%5Bi%5D;%0A            %0A%09%09%09if (currentItem.name.equals(%22Aged Brie%22) %7C%7C currentItem
 .nam
@@ -636,48 +636,62 @@
     
-        if (items%5Bi%5D.quality %3E 0) %7B%0A    
+%09%09%09increaseQuality(currentItem);%0A            %7D else %7B%0A
     
@@ -702,32 +702,35 @@
         if (
-items%5Bi%5D
+currentItem
 .name.equals
@@ -772,36 +772,32 @@
                 
-    
 %7D else %7B%0A       
@@ -781,36 +781,32 @@
        %7D else %7B%0A
-    
                 
@@ -821,39 +821,38 @@
 easeQuality(
-items%5Bi%5D);%0A    
+currentItem);%0A
             
@@ -873,115 +873,38 @@
     
-    %7D%0A            %7D else %7B%0A            %09%09increaseQuality(items%5Bi%5D);%0A            %7D%0A%0A            if (items%5Bi%5D
+%7D%0A%0A            if (currentItem
 .nam
@@ -976,32 +976,35 @@
         if (
-items%5Bi%5D
+currentItem
 .sellIn %3C 11
@@ -1034,32 +1034,35 @@
 easeQuality(
-items%5Bi%5D
+currentItem
 );%0A         
@@ -1086,32 +1086,35 @@
         if (
-items%5Bi%5D
+currentItem
 .sellIn %3C 6)
@@ -1143,32 +1143,35 @@
 easeQuality(
-items%5Bi%5D
+currentItem
 );%0A         
@@ -1222,24 +1222,27 @@
     if (
-items%5Bi%5D
+currentItem
 .name.eq
@@ -1317,24 +1317,27 @@
         
-items%5Bi%5D
+currentItem
 .sellIn-
@@ -1370,24 +1370,27 @@
     if (
-items%5Bi%5D
+currentItem
 .sellIn 
@@ -1412,33 +1412,35 @@
         if (
-!items%5Bi%5D
+currentItem
 .name.equals
@@ -1468,33 +1468,102 @@
     
-            if (!items%5Bi%5D
+%09%09%09%09increaseQuality(currentItem);%0A                %7D else %7B%0A                    if (currentItem
 .nam
@@ -1647,20 +1647,19 @@
     
-if (items%5Bi%5D
+currentItem
 .qua
@@ -1667,19 +1667,42 @@
 ity 
-%3E 0) %7B
+= 0;
 %0A    
+                %7D else %7B%0A
     
@@ -1729,17 +1729,19 @@
 if (
-!items%5Bi%5D
+currentItem
 .nam
@@ -1786,13 +1786,9 @@
 ) %7B%0A
-%09    
+%0A
     
@@ -1811,164 +1811,73 @@
     
-decreaseQuality(items%5Bi%5D);%0A                            %7D%0A                        %7D%0A                    %7D else %7B%0A                        items%5Bi%5D.quality = 0
+%7D else %7B%0A                            decreaseQuality(currentItem)
 ;%0A  
@@ -1886,38 +1886,38 @@
                 
-%7D%0A
     
+%7D%0A
             %7D el
@@ -1916,58 +1916,17 @@
     
-%7D else %7B%0A            %09%09%09increaseQuality(items%5Bi%5D);
+        %7D
 %0A   

Express the same ifs as positive expressions