mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-04 09:11:39 +00:00
em
This commit is contained in:
parent
b2e26bd812
commit
3e07becb36
@ -10,9 +10,9 @@ class GildedRose {
|
||||
|
||||
public void updateQuality() {
|
||||
for (Item item : items) {
|
||||
if (item.name.equals(Item.AGED_BRIE)) {
|
||||
if (isAgedBride(item)) {
|
||||
item.increaseQualityByOne();
|
||||
} else if (item.name.equals(Item.BACKSTAGE_PASSES)) {
|
||||
} else if (isBackstagePasses(item)) {
|
||||
item.increaseQualityBackstage();
|
||||
} else {
|
||||
item.decreaseQualityByOne();
|
||||
@ -21,9 +21,9 @@ class GildedRose {
|
||||
item.decreaseSellInEachDay();
|
||||
|
||||
if (item.sellIn < 0) {
|
||||
if (item.name.equals(Item.AGED_BRIE)) {
|
||||
if (isAgedBride(item)) {
|
||||
item.increaseQualityByOne();
|
||||
} else if (item.name.equals(Item.BACKSTAGE_PASSES)) {
|
||||
} else if (isBackstagePasses(item)) {
|
||||
item.quality = 0;
|
||||
} else {
|
||||
item.decreaseQualityByOne();
|
||||
@ -32,4 +32,12 @@ class GildedRose {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isBackstagePasses(Item item) {
|
||||
return item.name.equals(Item.BACKSTAGE_PASSES);
|
||||
}
|
||||
|
||||
private static boolean isAgedBride(Item item) {
|
||||
return item.name.equals(Item.AGED_BRIE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user