mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-04 09:11:39 +00:00
create static names
This commit is contained in:
parent
623cee709a
commit
75e919f36a
@ -1,6 +1,9 @@
|
||||
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";
|
||||
Item[] items;
|
||||
|
||||
public GildedRose(Item[] items) {
|
||||
@ -9,12 +12,12 @@ class GildedRose {
|
||||
|
||||
public void updateQuality() {
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
if (items[i].name.equals("Aged Brie")
|
||||
|| items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||
if (items[i].name.equals(AGED_BRIE)
|
||||
|| items[i].name.equals(BACKSTAGE_PASSES)) {
|
||||
if (items[i].quality < 50) {
|
||||
items[i].quality = items[i].quality + 1;
|
||||
|
||||
if (items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||
if (items[i].name.equals(BACKSTAGE_PASSES)) {
|
||||
if (items[i].sellIn < 11) {
|
||||
if (items[i].quality < 50) {
|
||||
items[i].quality = items[i].quality + 1;
|
||||
@ -30,21 +33,21 @@ class GildedRose {
|
||||
}
|
||||
} else {
|
||||
if (items[i].quality > 0) {
|
||||
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
|
||||
if (!items[i].name.equals(SULFURAS)) {
|
||||
items[i].quality = items[i].quality - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
|
||||
if (!items[i].name.equals(SULFURAS)) {
|
||||
items[i].sellIn = items[i].sellIn - 1;
|
||||
}
|
||||
|
||||
if (items[i].sellIn < 0) {
|
||||
if (!items[i].name.equals("Aged Brie")) {
|
||||
if (!items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||
if (!items[i].name.equals(AGED_BRIE)) {
|
||||
if (!items[i].name.equals(BACKSTAGE_PASSES)) {
|
||||
if (items[i].quality > 0) {
|
||||
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
|
||||
if (!items[i].name.equals(SULFURAS)) {
|
||||
items[i].quality = items[i].quality - 1;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user