mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 14:31:28 +00:00
24 lines
665 B
Java
24 lines
665 B
Java
package com.gildedrose.item;
|
|
|
|
public abstract class CustomisedItem {
|
|
|
|
public final void updateState(Item item) {
|
|
item.sellIn = updatedItemSellIn();
|
|
item.quality = updatedItemQuality();
|
|
|
|
if (hasReachedLowestQualityValue()) {
|
|
item.quality = QualityValues.lowestValuePossible();
|
|
} else if (hasReachedHighestQualityValue()) {
|
|
item.quality = QualityValues.highestValuePossible(item);
|
|
}
|
|
}
|
|
|
|
abstract int updatedItemSellIn();
|
|
|
|
abstract int updatedItemQuality();
|
|
|
|
protected abstract boolean hasReachedHighestQualityValue();
|
|
|
|
protected abstract boolean hasReachedLowestQualityValue();
|
|
}
|