mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-16 06:51:27 +00:00
Add switch/case
This commit is contained in:
parent
851d9c423a
commit
a631413208
@ -19,6 +19,14 @@ class GildedRose {
|
||||
}
|
||||
|
||||
private static void handleDay(Item item) {
|
||||
switch (item.name) {
|
||||
case AGED_BRIE:
|
||||
handleAgedBrie(item);
|
||||
return;
|
||||
case SULFURAS:
|
||||
handleSulfuras(item);
|
||||
return;
|
||||
}
|
||||
if (!item.name.equals(AGED_BRIE)
|
||||
&& !item.name.equals(BACKSTAGE_PASSES)) {
|
||||
if (item.quality > 0) {
|
||||
@ -68,4 +76,15 @@ class GildedRose {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleSulfuras(Item item) {
|
||||
|
||||
}
|
||||
|
||||
private static void handleAgedBrie(Item item) {
|
||||
if (item.quality != 50) {
|
||||
item.quality += 1;
|
||||
}
|
||||
item.sellIn -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user