From 1388d78244e96c120970c0cd1ca0e0d8e9b7690c Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Thu, 12 Mar 2020 09:28:03 +0100 Subject: [PATCH] Javadoc for Item --- .../kit/informatik/cardgame/model/Item.java | 54 ++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/src/edu/kit/informatik/cardgame/model/Item.java b/src/edu/kit/informatik/cardgame/model/Item.java index 33dabb5..12fdd56 100644 --- a/src/edu/kit/informatik/cardgame/model/Item.java +++ b/src/edu/kit/informatik/cardgame/model/Item.java @@ -3,22 +3,51 @@ package edu.kit.informatik.cardgame.model; import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.List; import static edu.kit.informatik.cardgame.model.Card.METAL; import static edu.kit.informatik.cardgame.model.Card.PLASTIC; import static edu.kit.informatik.cardgame.model.Card.WOOD; public enum Item { + /** + * Axe. Provides an attack bonus of two. + */ AXE, + /** + * Club. Provides an attack bonus of one. + */ CLUB, + /** + * Shack. Can save the last five items. + */ SHACK, + /** + * Fireplace. Required for some advanced items. + */ FIREPLACE, + /** + * Sailing raft. Can be used to attempt an escape. + */ SAILING_RAFT, + /** + * Hang glider. Can be used to attempt to escape. + */ HANG_GLIDER, + /** + * Steam boat. Can be used to escape. + */ STEAMBOAT, + /** + * Ballon: making it seem as though a [stranded person] effortlessly becomes airborne, + * floats in the air, and lands softly. + */ BALLON; + /** + * Resources needed to build this item, in no particular order. + * + * @return resources needed to build this item + */ public Card[] resourcesNeeded() { switch (this) { case AXE: @@ -42,6 +71,11 @@ public enum Item { } } + /** + * Items required to be able to build this item. Building this item does not consume the items returned. + * + * @return items required to build this item + */ public Collection itemsNeededToBuild() { switch (this) { case BALLON: @@ -52,6 +86,11 @@ public enum Item { } } + /** + * Get the fighting bonus of this item against animals. + * + * @return fighting bonus of this item + */ public int fightingBonus() { switch (this) { case AXE: @@ -63,6 +102,13 @@ public enum Item { } } + /** + * Parse a single word and return the item represented by the input. + * Fun fact: Item.parse(item.toString()) == item is true for all items. + * + * @param input text + * @return parsed item or null if not found + */ public static Item parse(String input) { switch (input) { case "axe": @@ -86,6 +132,12 @@ public enum Item { } } + /** + * Get the textual representation of this item. + * Fun fact: Item.parse(item.toString()) == item is true for all items. + * + * @return textual representation of this item + */ @Override public String toString() { switch (this) {