mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-19 16:31:30 +00:00
Add static constructor methods for easy-of-use
This commit is contained in:
parent
620d48221b
commit
f98d6bcaf6
@ -9,6 +9,10 @@ public class DefaultQualityBehavior implements QualityBehavior {
|
||||
public static final int DEFAULT_QUALITY_DECREASE = 1;
|
||||
public static final int FASTER_QUALITY_DECREASE = 2;
|
||||
|
||||
public static DefaultQualityBehavior newInstance() {
|
||||
return new DefaultQualityBehavior();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processQualityUpdate(Item item) {
|
||||
decreaseQuality(item);
|
||||
|
||||
@ -7,6 +7,10 @@ public class IncreasingQualityBehavior implements QualityBehavior {
|
||||
public static final int MAX_QUALITY_LEVEL = 50;
|
||||
public static final int MIN_QUALITY_LEVEL = 0;
|
||||
|
||||
public static IncreasingQualityBehavior newInstance() {
|
||||
return new IncreasingQualityBehavior();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processQualityUpdate(Item item) {
|
||||
increaseQuality(item);
|
||||
|
||||
@ -4,6 +4,10 @@ import com.gildedrose.Item;
|
||||
|
||||
public class DefaultSellInBehavior implements SellInBehavior {
|
||||
|
||||
public static DefaultSellInBehavior newInstance() {
|
||||
return new DefaultSellInBehavior();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processSellInUpdate(Item item) {
|
||||
decreaseSellIn(item);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user