-
-
Save jerrinot/c8d5509235b43a123990 to your computer and use it in GitHub Desktop.
HealthState example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum Health { | |
HEALTHY(false, false, false, false), | |
INCUBATIOUS(true, false, false, false), | |
SICK(true...), | |
DEAD(....); | |
private boolean infected; | |
private boolean sick; | |
private boolean immune; | |
private boolean dead; | |
private Health(boolean infected, boolean sick, boolean immune, boolean dead) { | |
this.infected = infected; | |
this.sick = sick; | |
this.immune = immune; | |
this.dead = dead; | |
} | |
public boolean isInfected() { | |
return infected; | |
} | |
public boolean isSick() { | |
return sick; | |
} | |
public Health evolve() { | |
switch (this) { | |
case HEALTHY: | |
return computeProbabability..() ? INCUBATIOUS : HEALTHY; | |
[....] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment