Merge pull request #3 from Decker-Matthew-R/cpage

name refactor
This commit is contained in:
Matt Decker 2022-07-02 09:56:54 -05:00 committed by GitHub
commit cf74c0256a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;
}
}