Skip to content

Commit

Permalink
주석 달기
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeonkyujin committed Oct 30, 2024
1 parent 67ba9f1 commit 47026ac
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions Java/src/main/java/com/gildedrose/AgedBrieItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public AgedBrieItem(Item item) {
@Override
public void updateQuality() {
increaseQuality(item);
//나머지 일수가 없어지면 2배로 증가
if (item.sellIn < 0) {
increaseQuality(item);
}
Expand Down
4 changes: 4 additions & 0 deletions Java/src/main/java/com/gildedrose/BackStageItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ public BackStageItem(Item item) {

@Override
public void updateQuality() {
//남은 일자가 11일이상이면 1 증가
increaseQuality(item);
//남은 일자가 6~10일이면 2 증가
if (item.sellIn <= 10) {
increaseQuality(item);
}
//남은 일자가 5일이하면 3증가
if (item.sellIn <= 5) {
increaseQuality(item);
}
//남은 일자가 없으면 0
if (item.sellIn == 0) {
item.quality = 0;
}
Expand Down
1 change: 1 addition & 0 deletions Java/src/main/java/com/gildedrose/CommonItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public CommonItem(Item item) {
@Override
public void updateQuality() {
decreaseQuality(item);
//나머지 일수가 없어지면 2배로 감소
if (item.sellIn < 0) {
decreaseQuality(item);
}
Expand Down
1 change: 1 addition & 0 deletions Java/src/main/java/com/gildedrose/ConjuredItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public ConjuredItem(Item item) {
@Override
public void updateQuality() {
doubleDecreaseQuality(item);
//나머지 일수가 없어지면 2배로 감소
if (item.sellIn < 0) {
doubleDecreaseQuality(item);
}
Expand Down
3 changes: 3 additions & 0 deletions Java/src/main/java/com/gildedrose/GildedRose.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
class GildedRose {
Item[] items;

//추상클래스를 배열 변수로 사용
UpdateItem[] updatingItems;

//추상클래스 배열 변수에 자식클래스 인스턴스 담기
public GildedRose(Item[] items) {
this.items = items;
this.updatingItems = new UpdateItem[items.length];
Expand All @@ -24,6 +26,7 @@ public GildedRose(Item[] items) {
}

public void updateQuality() {
//item에 따라 적절한 구현클래스 로직 실행
for (UpdateItem item : updatingItems) {
item.updateQuality();

Expand Down

0 comments on commit 47026ac

Please sign in to comment.