void () { switch (myRunState) { case VIRGIN: throw new IllegalStateException("Indicator can't be stopped because it wasn't started"); case STARTED: myRunState = RunState.STOPPED; break; case STOPPED: throw new IllegalStateException("Indicator already stopped"); } }