mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
Add comments to updateQuality method in GildedRose class
This commit is contained in:
parent
19c82cea64
commit
76f229863b
@ -9,6 +9,8 @@ class GildedRose {
|
||||
|
||||
public void updateQuality() {
|
||||
for (Item item : items) {
|
||||
// "Aged Brie"와 "Backstage passes"가 아닌 경우
|
||||
// 품질이 0보다 크면 "Sulfuras, Hand of Ragnaros" 제외 아이템 품질을 1 감소
|
||||
if (!item.name.equals("Aged Brie")
|
||||
&& !item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||
if (item.quality > 0) {
|
||||
@ -17,6 +19,9 @@ class GildedRose {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// "Aged Brie" 또는 "Backstage passes"인 경우 품질 50 미만이면 품질 1 증가
|
||||
// "Backstage passes"의 경우 품질이 50 미만이고 판매일이 11일 미만인 경우 추가로 1 증가
|
||||
// 판매일이 6일 미만인 경우 또한 추가로 1 증가
|
||||
if (item.quality < 50) {
|
||||
item.quality = item.quality + 1;
|
||||
|
||||
@ -36,10 +41,15 @@ class GildedRose {
|
||||
}
|
||||
}
|
||||
|
||||
// "Sulfuras, Hand of Ragnaros"가 아닌 경우 판매일을 1 줄임
|
||||
if (!item.name.equals("Sulfuras, Hand of Ragnaros")) {
|
||||
item.sellIn = item.sellIn - 1;
|
||||
}
|
||||
|
||||
// 판매일이 지난 경우
|
||||
// "Aged Brie"가 아니고, "Backstage passes"가 아닌 경우 품질이 0 보다 크면 줄임
|
||||
// "Backstage passes"가 아닌 경우 품질을 0으로 변경
|
||||
// "Aged Brie"인 경우 품질이 50 미만이면 증가
|
||||
if (item.sellIn < 0) {
|
||||
if (!item.name.equals("Aged Brie")) {
|
||||
if (!item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user