mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-04 09:11:39 +00:00
rename, and add final for static string variables
This commit is contained in:
parent
a2879d203a
commit
287daf6e0d
@ -1,9 +1,10 @@
|
||||
package com.gildedrose;
|
||||
|
||||
class GildedRose {
|
||||
private static String AGED_BRIE = "Aged Brie";
|
||||
private static String BACKSTAGE_PASSES = "Backstage passes to a TAFKAL80ETC concert";
|
||||
private static String SULFURAS = "Sulfuras, Hand of Ragnaros";
|
||||
private final static String AGED_BRIE = "Aged Brie";
|
||||
private final static String BACKSTAGE_PASSES = "Backstage passes to a TAFKAL80ETC concert";
|
||||
private final static String SULFURAS = "Sulfuras, Hand of Ragnaros";
|
||||
|
||||
Item[] items;
|
||||
|
||||
public GildedRose(Item[] items) {
|
||||
@ -13,14 +14,14 @@ class GildedRose {
|
||||
public void updateQuality() {
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
if (items[i].name.equals(AGED_BRIE)) {
|
||||
incrementQualityByOne(i);
|
||||
increaseQualityByOne(i);
|
||||
} else if (items[i].name.equals(BACKSTAGE_PASSES)) {
|
||||
if (items[i].sellIn < 6) {
|
||||
increaseQualityByThree(i);
|
||||
} else if (items[i].sellIn < 11) {
|
||||
increaseQualityByTwo(i);
|
||||
} else {
|
||||
incrementQualityByOne(i);
|
||||
increaseQualityByOne(i);
|
||||
}
|
||||
} else {
|
||||
decreaseQualityByOne(i);
|
||||
@ -32,7 +33,7 @@ class GildedRose {
|
||||
|
||||
if (items[i].sellIn < 0) {
|
||||
if (items[i].name.equals(AGED_BRIE)) {
|
||||
incrementQualityByOne(i);
|
||||
increaseQualityByOne(i);
|
||||
} else {
|
||||
if (items[i].name.equals(BACKSTAGE_PASSES)) {
|
||||
items[i].quality = 0;
|
||||
@ -46,12 +47,12 @@ class GildedRose {
|
||||
|
||||
private void increaseQualityByThree(int i) {
|
||||
increaseQualityByTwo(i);
|
||||
incrementQualityByOne(i);
|
||||
increaseQualityByOne(i);
|
||||
}
|
||||
|
||||
private void increaseQualityByTwo(int i) {
|
||||
incrementQualityByOne(i);
|
||||
incrementQualityByOne(i);
|
||||
increaseQualityByOne(i);
|
||||
increaseQualityByOne(i);
|
||||
}
|
||||
|
||||
private void decreaseQualityByOne(int i) {
|
||||
@ -62,7 +63,7 @@ class GildedRose {
|
||||
}
|
||||
}
|
||||
|
||||
private void incrementQualityByOne(int i) {
|
||||
private void increaseQualityByOne(int i) {
|
||||
if (items[i].quality < 50) {
|
||||
items[i].quality = items[i].quality + 1;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user