Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/fi/
Binary file modified bin/fi/oulu/tol/sqat/GildedRose.class
Binary file not shown.
Binary file modified bin/fi/oulu/tol/sqat/Item.class
Binary file not shown.
Binary file modified bin/fi/oulu/tol/sqat/tests/GildedRoseTest.class
Binary file not shown.
14 changes: 7 additions & 7 deletions src/fi/oulu/tol/sqat/GildedRose.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,31 @@ public static void updateEndOfDay()
{
if (!"Sulfuras, Hand of Ragnaros".equals(items.get(i).getName()))
{
items.get(i).setQuality(items.get(i).getQuality() - 1);
items.get(i).decreaseQuality(items.get(i).quality);
}
}
}
else
{
if (items.get(i).getQuality() < 50)
{
items.get(i).setQuality(items.get(i).getQuality() + 1);
items.get(i).increaseQuality(items.get(i).quality);

if ("Backstage passes to a TAFKAL80ETC concert".equals(items.get(i).getName()))
{
if (items.get(i).getSellIn() < 11)
{
if (items.get(i).getQuality() < 50)
{
items.get(i).setQuality(items.get(i).getQuality() + 1);
items.get(i).increaseQuality(items.get(i).quality);
}
}

if (items.get(i).getSellIn() < 6)
{
if (items.get(i).getQuality() < 50)
{
items.get(i).setQuality(items.get(i).getQuality() + 1);
items.get(i).increaseQuality(items.get(i).quality);
}
}
}
Expand All @@ -62,7 +62,7 @@ public static void updateEndOfDay()

if (!"Sulfuras, Hand of Ragnaros".equals(items.get(i).getName()))
{
items.get(i).setSellIn(items.get(i).getSellIn() - 1);
items.get(i).decreaseSellIn(items.get(i).sellIn);
}

if (items.get(i).getSellIn() < 0)
Expand All @@ -75,7 +75,7 @@ public static void updateEndOfDay()
{
if (!"Sulfuras, Hand of Ragnaros".equals(items.get(i).getName()))
{
items.get(i).setQuality(items.get(i).getQuality() - 1);
items.get(i).decreaseQuality(items.get(i).quality);
}
}
}
Expand All @@ -88,7 +88,7 @@ public static void updateEndOfDay()
{
if (items.get(i).getQuality() < 50)
{
items.get(i).setQuality(items.get(i).getQuality() + 1);
items.get(i).increaseQuality(items.get(i).quality);
}
}
}
Expand Down
21 changes: 21 additions & 0 deletions src/fi/oulu/tol/sqat/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,26 @@ public int getQuality() {
public void setQuality(int quality) {
this.quality = quality;
}

/* Ari's implementations */
public void increaseQuality(int quality) {
this.setQuality(getQuality() + 1);
}
public void decreaseQuality(int quality) {
this.setQuality(getQuality() - 1);
}
public void decreaseSellIn(int sellIn) {
this.setSellIn(getSellIn() - 1);
}
public void isExpired() {
// Not implemented yet
}
public void hasReachedMaximumQuality() {
// Not implemented yet
}
public void hasZeroQuality(int quality) {
// Not implemented yet
}

}

Loading