mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-18 16:01:42 +00:00
40 lines
777 B
Java
40 lines
777 B
Java
package com.gildedrose.items;
|
|
|
|
import com.gildedrose.item_helpers.ItemType;
|
|
import com.gildedrose.main.Item;
|
|
|
|
public class LegendaryItem implements ItemType {
|
|
|
|
public static final int LEGENDARY_ITEM_QUALITY = 80;
|
|
public static final String LEGENDARY = "Sulfuras, Hand of Ragnaros";
|
|
|
|
private final Item item;
|
|
|
|
public LegendaryItem(Item item) {
|
|
this.item = item;
|
|
}
|
|
|
|
@Override
|
|
public void updateQuality() {
|
|
decrementSellInDate();
|
|
}
|
|
|
|
@Override
|
|
public String getName() {
|
|
return LEGENDARY;
|
|
}
|
|
|
|
public void decrementSellInDate() {
|
|
item.sellIn--;
|
|
}
|
|
|
|
public static boolean isLegendary(Item item) {
|
|
return item.name.equals(LEGENDARY);
|
|
}
|
|
|
|
public static boolean isNotLegendary(Item item) {
|
|
return !item.name.equals(LEGENDARY);
|
|
}
|
|
|
|
}
|