diff --git a/Java/src/main/java/com/gildedrose/GildedRose.java b/Java/src/main/java/com/gildedrose/GildedRose.java index 43e9ed84..da8a1994 100644 --- a/Java/src/main/java/com/gildedrose/GildedRose.java +++ b/Java/src/main/java/com/gildedrose/GildedRose.java @@ -7,6 +7,9 @@ class GildedRose { this.items = items; } + /** + * Update the quality of the items + */ public void updateQuality() { for (Item item : items) { updateItemQuality(item); @@ -15,6 +18,10 @@ class GildedRose { } } + /** + * Update the quality of the item + * @param item the item to update + */ private void updateItemQuality(Item item) { if (isSpecialItem(item)) { increaseQuality(item); @@ -26,12 +33,20 @@ class GildedRose { } } + /** + * Update the sellIn of the item + * @param item the item to update + */ private void updateItemSellIn(Item item) { if (!item.name.equals("Sulfuras, Hand of Ragnaros")) { item.sellIn--; } } + /** + * Handle the expired item + * @param item the item to handle + */ private void handleExpiredItem(Item item) { if (item.sellIn < 0) { if (item.name.equals("Aged Brie")) { @@ -44,22 +59,39 @@ class GildedRose { } } + /** + * Check if the item is a special item + * @param item the item to check + * @return true if the item is a special item, false otherwise + */ private boolean isSpecialItem(Item item) { return item.name.equals("Aged Brie") || item.name.equals("Backstage passes to a TAFKAL80ETC concert"); } + /** + * Increase the quality of the item + * @param item the item to increase the quality + */ private void increaseQuality(Item item) { if (item.quality < 50) { item.quality++; } } + /** + * Decrease the quality of the item + * @param item the item to decrease the quality + */ private void decreaseQuality(Item item) { if (item.quality > 0 && !item.name.equals("Sulfuras, Hand of Ragnaros")) { item.quality--; } } + /** + * Handle the backstage passes + * @param item the item to handle + */ private void handleBackstagePasses(Item item) { if (item.sellIn < 11) { increaseQuality(item);