Skip to content

Package: GameBuilderFactory

GameBuilderFactory

nameinstructionbranchcomplexitylinemethod
extendInputProvider(InputProvider)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright © 2020-2023 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: import java.util.List;
22:
23: import de.fhdw.gaming.core.ui.InputProvider;
24: import de.fhdw.gaming.core.ui.InputProviderException;
25:
26: /**
27: * Allows to create a {@link GameBuilder}.
28: */
29: public interface GameBuilderFactory {
30:
31: /**
32: * Parameter for the name of a player.
33: */
34: String PARAM_PLAYER_NAME = "playerName";
35: /**
36: * Parameter for a player's strategy.
37: */
38: String PARAM_PLAYER_STRATEGY = "playerStrategy";
39: /**
40: * Parameter for the maximum computation time per move in seconds.
41: */
42: String PARAM_MAX_COMPUTATION_TIME_PER_MOVE = "maxComputationTimePerMove";
43:
44: /**
45: * Returns the name of the game.
46: */
47: String getName();
48:
49: /**
50: * Returns the minimum number of players in a game.
51: */
52: int getMinimumNumberOfPlayers();
53:
54: /**
55: * Returns the maximum number of players in a game.
56: */
57: int getMaximumNumberOfPlayers();
58:
59: /**
60: * Returns all strategies.
61: */
62: List<? extends Strategy<?, ?, ?>> getStrategies();
63:
64: /**
65: * Creates a {@link GameBuilder} object.
66: *
67: * @param inputProvider The input provider to use (if necessary) in order to determine mandatory or optional
68: * parameters for creating the game. Mandatory parameters are the players' names and
69: * strategies. All other parameters need to have meaningful default values.
70: * <p>
71: * The order of the data sets request is as follows:
72: * <ol>
73: * <li>Parameters for the game as a whole</li>
74: * <li>Parameters for player 1</li>
75: * <li>Parameters for player 2</li>
76: * <li>Parameters for player ...</li>
77: * </ol>
78: * @return A {@link GameBuilder} which allows to create a game as many times as desired.
79: * @throws GameException if the game creation fails for some reason.
80: */
81: GameBuilder createGameBuilder(InputProvider inputProvider) throws GameException;
82:
83: /**
84: * Returns the decorated {@link InputProvider}.
85: *
86: * @param inputProvider The input provider to use (if necessary) in order to
87: * determine mandatory or optional parameters for creating
88: * the game. Mandatory parameters are the players' names
89: * and strategies. All other parameters need to have
90: * meaningful default values.
91: * <p>
92: * The order of the data sets request is as follows:
93: * <ol>
94: * <li>Parameters for the game as a whole</li>
95: * <li>Parameters for player 1</li>
96: * <li>Parameters for player 2</li>
97: * <li>Parameters for player ...</li>
98: * </ol>
99: * @return An extended {@link InputProvider}.
100: * @throws InputProviderException if the decoration fails for some reason.
101: */
102: default InputProvider extendInputProvider(final InputProvider inputProvider) throws InputProviderException {
103: return inputProvider;
104: }
105: }