LOG121_TP01/src/simulation/BuildingState.java
2022-06-07 21:07:49 -04:00

25 lines
549 B
Java

package simulation;
import java.util.Arrays;
import java.util.Objects;
public enum BuildingState {
EMPTY("vide"),
ONE_THIRD("un-tiers"),
TWO_THIRD("deux-tiers"),
FULL("plein");
private final String typeName;
BuildingState(String typeName) {
this.typeName = typeName;
}
public static BuildingState getFromTypeName(String typeName) {
return Arrays.stream(BuildingState.values())
.filter(t -> Objects.equals(t.typeName, typeName))
.findFirst().orElse(null);
}
}