mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-17 15:31:27 +00:00
invert if condition
invert if condition to simplify the code
This commit is contained in:
parent
7422960de8
commit
bdcd441019
@ -22,31 +22,31 @@ class GildedRose {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void updateQuality(Item item) {
|
private static void updateQuality(Item item) {
|
||||||
if (!item.name.equals("Aged Brie")
|
if (item.name.equals("Aged Brie")
|
||||||
&& !item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
|| item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||||
|
if (item.quality < 50) {
|
||||||
|
item.quality++;
|
||||||
|
|
||||||
|
if (item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||||
|
if (item.sellIn < 11) {
|
||||||
|
if (item.quality < 50) {
|
||||||
|
item.quality++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.sellIn < 6) {
|
||||||
|
if (item.quality < 50) {
|
||||||
|
item.quality++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (item.quality > 0) {
|
if (item.quality > 0) {
|
||||||
if (!item.name.equals("Sulfuras, Hand of Ragnaros")) {
|
if (!item.name.equals("Sulfuras, Hand of Ragnaros")) {
|
||||||
item.quality--;
|
item.quality--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (item.quality < 50) {
|
|
||||||
item.quality++;
|
|
||||||
|
|
||||||
if (item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
|
||||||
if (item.sellIn < 11) {
|
|
||||||
if (item.quality < 50) {
|
|
||||||
item.quality++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.sellIn < 6) {
|
|
||||||
if (item.quality < 50) {
|
|
||||||
item.quality++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user