@Override public IMPL evaluateGame(final IMPL game) { switch (game.getGamePhase()) { case Challenged: return evaluateChallengedPhase(game); case Setup: return evaluateSetupPhase(game); case Playing: return evaluatePlayingPhase(game); case RoundOver: return evaluateRoundOverPhase(game); case Declined: return evaluateDeclinedPhase(game); case NextRoundStarted: return evaluateNextRoundStartedPhase(game); case Quit: return evaluateQuitPhase(game); } return null; }
@SuppressWarnings("unused") protected IMPL changeStateAndReevaluate(final GamePhase transitionTo, final IMPL game) { game.setGamePhase(transitionTo); return evaluateGame(game); } }
@Override protected IMPL evaluateRoundOverPhase(final IMPL game) { if (game.getRematchTimestamp() != null) { return changeStateAndReevaluate(GamePhase.NextRoundStarted, game); } return super.evaluateRoundOverPhase(game); }