2020-02-24 16:02:48 +00:00
|
|
|
package edu.kit.informatik.model;
|
|
|
|
|
|
|
|
public enum Card {
|
|
|
|
WOOD,
|
|
|
|
METAL,
|
|
|
|
PLASTIC,
|
|
|
|
SPIDER,
|
|
|
|
SNAKE,
|
|
|
|
TIGER,
|
|
|
|
THUNDERSTORM;
|
2020-02-24 16:39:27 +00:00
|
|
|
|
|
|
|
public boolean isResource() {
|
|
|
|
return this.equals(WOOD) || this.equals(METAL) || this.equals(PLASTIC);
|
|
|
|
}
|
|
|
|
|
2020-02-24 16:02:48 +00:00
|
|
|
public static Card parse(String input) {
|
|
|
|
switch (input) {
|
|
|
|
case "wood":
|
|
|
|
return WOOD;
|
|
|
|
case "metal":
|
|
|
|
return METAL;
|
|
|
|
case "plastic":
|
|
|
|
return PLASTIC;
|
|
|
|
case "spider":
|
|
|
|
return SPIDER;
|
|
|
|
case "snake":
|
|
|
|
return SNAKE;
|
|
|
|
case "tiger":
|
|
|
|
return TIGER;
|
|
|
|
case "thunderstorm":
|
|
|
|
return THUNDERSTORM;
|
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
2020-02-24 16:39:27 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
switch (this) {
|
|
|
|
case WOOD:
|
|
|
|
return "wood";
|
|
|
|
case METAL:
|
|
|
|
return "metal";
|
|
|
|
case PLASTIC:
|
|
|
|
return "plastic";
|
|
|
|
case SPIDER:
|
|
|
|
return "spider";
|
|
|
|
case SNAKE:
|
|
|
|
return "snake";
|
|
|
|
case TIGER:
|
|
|
|
return "tiger";
|
|
|
|
case THUNDERSTORM:
|
|
|
|
return "thunderstorm";
|
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
2020-02-24 16:02:48 +00:00
|
|
|
}
|