mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 14:31:28 +00:00
make the first if condition positive
This commit is contained in:
parent
df0319f849
commit
1aae554b54
@ -20,41 +20,37 @@ class GildedRose {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateQuality() {
|
public void updateQuality() {
|
||||||
|
String SULFURA = "Sulfuras, Hand of Ragnaros";
|
||||||
|
String AGED_BRIE = "Aged Brie";
|
||||||
|
String BACKSTAGE = "Backstage passes to a TAFKAL80ETC concert";
|
||||||
|
|
||||||
|
|
||||||
for (Item item : items) {
|
for (Item item : items) {
|
||||||
if (item.name.equals("Sulfuras, Hand of Ragnaros")) {
|
if (item.name.equals(SULFURA)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (!item.name.equals("Aged Brie")) {
|
if (item.name.equals(AGED_BRIE) || item.name.equals(BACKSTAGE)) {
|
||||||
if (!item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
|
||||||
decreaseQuality(item);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (!item.name.equals("Aged Brie")
|
|
||||||
&& !item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
|
||||||
decreaseQuality(item);
|
|
||||||
} else {
|
|
||||||
increaseQuality(item);
|
increaseQuality(item);
|
||||||
if (item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
if (item.name.equals(BACKSTAGE)) {
|
||||||
if (item.sellIn < 11) {
|
if (item.sellIn < 11) {
|
||||||
increaseQuality(item);
|
increaseQuality(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.sellIn < 6) {
|
if (item.sellIn < 6) {
|
||||||
increaseQuality(item);
|
increaseQuality(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
decreaseQuality(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
item.sellIn = item.sellIn - 1;
|
item.sellIn = item.sellIn - 1;
|
||||||
|
|
||||||
|
|
||||||
if (item.sellIn < 0) {
|
if (item.sellIn < 0) {
|
||||||
if (item.name.equals("Aged Brie")) {
|
if (item.name.equals(AGED_BRIE)) {
|
||||||
increaseQuality(item);
|
increaseQuality(item);
|
||||||
} else if (item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
} else if (item.name.equals(BACKSTAGE)) {
|
||||||
item.quality -= item.quality;
|
item.quality -= item.quality;
|
||||||
} else {
|
} else {
|
||||||
decreaseQuality(item);
|
decreaseQuality(item);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user