name refactor

This commit is contained in:
cammp325 2022-07-02 10:55:18 -04:00
parent 6243a16770
commit 08588baf9d

View File

@ -1,6 +1,10 @@
package com.gildedrose;
class GildedRose {
class GildedRose {
public static final String AGED_BRIE = "Aged Brie";
public static final String SULFURAS = "Sulfuras, Hand of Ragnaros";
public static final String BACKSTAGE = "Backstage passes to a TAFKAL80ETC concert";
private Item[] items;
@ -15,10 +19,10 @@ class GildedRose {
}
private void updateItemQuality(Item item) {
if (!item.name.equals("Aged Brie")
&& !item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
if (!item.name.equals(AGED_BRIE)
&& !item.name.equals(BACKSTAGE)) {
if (item.quality > 0) {
if (!item.name.equals("Sulfuras, Hand of Ragnaros")) {
if (!item.name.equals(SULFURAS)) {
item.quality = item.quality - 1;
}
}
@ -26,7 +30,7 @@ class GildedRose {
if (item.quality < 50) {
item.quality = item.quality + 1;
if (item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
if (item.name.equals(BACKSTAGE)) {
if (item.sellIn < 11) {
if (item.quality < 50) {
item.quality = item.quality + 1;
@ -42,15 +46,15 @@ class GildedRose {
}
}
if (!item.name.equals("Sulfuras, Hand of Ragnaros")) {
if (!item.name.equals(SULFURAS)) {
item.sellIn = item.sellIn - 1;
}
if (item.sellIn < 0) {
if (!item.name.equals("Aged Brie")) {
if (!item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
if (!item.name.equals(AGED_BRIE)) {
if (!item.name.equals(BACKSTAGE)) {
if (item.quality > 0) {
if (!item.name.equals("Sulfuras, Hand of Ragnaros")) {
if (!item.name.equals(SULFURAS)) {
item.quality = item.quality - 1;
}
}