mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 14:31:28 +00:00
[COSMETIC] private at the end
This commit is contained in:
parent
fd938e05ba
commit
fbc21a54c6
@ -13,6 +13,25 @@ class GildedRose {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public void updateQuality() {
|
||||
Item[] agingItems = Arrays.stream(items).filter(i -> !i.name.equals(sulfuras)).toArray(Item[]::new);
|
||||
Item[] bries = Arrays.stream(agingItems).filter(i -> i.name.equals(agedBrie)).toArray(Item[]::new);
|
||||
Item[] backstagePasses = Arrays.stream(agingItems).filter(i -> i.name.equals(backStagePasses)).toArray(Item[]::new);
|
||||
Item[] otherItems = Arrays.stream(agingItems).filter(i -> !i.name.equals(backStagePasses) && !i.name.equals(agedBrie)).toArray(Item[]::new);
|
||||
for (Item item : otherItems) {
|
||||
item.sellIn = item.sellIn - 1;
|
||||
decreaseQualityOfNormalItems(item);
|
||||
}
|
||||
for (Item brie : bries) {
|
||||
brie.sellIn = brie.sellIn - 1;
|
||||
increaseQualityOfBries(brie);
|
||||
}
|
||||
for (Item item : backstagePasses) {
|
||||
item.sellIn = item.sellIn - 1;
|
||||
changeQualityOfPasses(item);
|
||||
}
|
||||
}
|
||||
|
||||
private int getDecreasedQuality(int oldQuality, int factor){
|
||||
return Math.max(oldQuality - factor, 0);
|
||||
}
|
||||
@ -41,23 +60,4 @@ class GildedRose {
|
||||
} else
|
||||
item.quality = getIncreasedQuality(item, 1);
|
||||
}
|
||||
|
||||
public void updateQuality() {
|
||||
Item[] agingItems = Arrays.stream(items).filter(i -> !i.name.equals(sulfuras)).toArray(Item[]::new);
|
||||
Item[] bries = Arrays.stream(agingItems).filter(i -> i.name.equals(agedBrie)).toArray(Item[]::new);
|
||||
Item[] backstagePasses = Arrays.stream(agingItems).filter(i -> i.name.equals(backStagePasses)).toArray(Item[]::new);
|
||||
Item[] otherItems = Arrays.stream(agingItems).filter(i -> !i.name.equals(backStagePasses) && !i.name.equals(agedBrie)).toArray(Item[]::new);
|
||||
for (Item item : otherItems) {
|
||||
item.sellIn = item.sellIn - 1;
|
||||
decreaseQualityOfNormalItems(item);
|
||||
}
|
||||
for (Item brie : bries) {
|
||||
brie.sellIn = brie.sellIn - 1;
|
||||
increaseQualityOfBries(brie);
|
||||
}
|
||||
for (Item item : backstagePasses) {
|
||||
item.sellIn = item.sellIn - 1;
|
||||
changeQualityOfPasses(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user