mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-16 23:11:28 +00:00
26 lines
597 B
Java
26 lines
597 B
Java
package com.gildedrose;
|
|
|
|
/**
|
|
* Class which update quality for all items
|
|
*/
|
|
class GildedRoseItem {
|
|
Item[] items;
|
|
private ItemFactory itemFactory;
|
|
|
|
public GildedRoseItem(Item[] items) {
|
|
this.items = items;
|
|
itemFactory = new ItemFactory();
|
|
}
|
|
|
|
/**
|
|
* Update quality and number of days left to sell
|
|
*/
|
|
public void updateQuality() {
|
|
for (Item item : items) {
|
|
ItemInterface typeItem = itemFactory.createItemType(item);
|
|
typeItem.updateNumberOfdayToSellRemaining();
|
|
typeItem.updateQuality();
|
|
}
|
|
}
|
|
}
|