Skip to content

Package: GameBuilder

GameBuilder

Coverage

1: /*
2: * Copyright © 2020 Fachhochschule für die Wirtschaft (FHDW) Hannover
3: *
4: * This file is part of gaming-core.
5: *
6: * Gaming-core is free software: you can redistribute it and/or modify it under
7: * the terms of the GNU General Public License as published by the Free Software
8: * Foundation, either version 3 of the License, or (at your option) any later
9: * version.
10: *
11: * Gaming-core is distributed in the hope that it will be useful, but WITHOUT
12: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14: * details.
15: *
16: * You should have received a copy of the GNU General Public License along with
17: * gaming-core. If not, see <http://www.gnu.org/licenses/>.
18: */
19: package de.fhdw.gaming.core.domain;
20:
21: /**
22: * A builder which allows to create a game.
23: */
24: public interface GameBuilder {
25:
26: /**
27: * The default maximum computation time per move in seconds.
28: */
29: int DEFAULT_MAX_COMPUTATION_TIME_PER_MOVE = 5;
30:
31: /**
32: * Changes the maximum computation time per move in seconds.
33: * <p>
34: * If this operation is called multiple times, only the last value will be retained. If not called, the default size
35: * of {@link #DEFAULT_MAX_COMPUTATION_TIME_PER_MOVE} seconds is used.
36: *
37: * @param newMaxComputationTimePerMove The new maximum computation time per move in seconds.
38: * @return {@code this}
39: */
40: GameBuilder changeMaximumComputationTimePerMove(int newMaxComputationTimePerMove);
41:
42: /**
43: * Builds the game. Can be called as many times as desired, each time returning a new game.
44: *
45: * @param id The ID of the game.
46: * @throws GameException if creating the game is not allowed by the rules of the game.
47: * @throws InterruptedException if creating the game has been interrupted.
48: */
49: Game<?, ?, ?, ?> build(int id) throws GameException, InterruptedException;
50: }