Skip to content

Package: OthelloPlayerBuilder

OthelloPlayerBuilder

Coverage

1: /*
2: * Copyright © 2020 Fachhochschule für die Wirtschaft (FHDW) Hannover
3: *
4: * This file is part of othello-core.
5: *
6: * Othello-core is free software: you can redistribute it and/or modify
7: * it under the terms of the GNU General Public License as published by
8: * the Free Software Foundation, either version 3 of the License, or
9: * (at your option) any later version.
10: *
11: * Othello-core is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with othello-core. If not, see <http://www.gnu.org/licenses/>.
18: */
19: package de.fhdw.gaming.othello.core.domain;
20:
21: import de.fhdw.gaming.core.domain.GameException;
22:
23: /**
24: * A builder which allows to create an Othello player.
25: */
26: public interface OthelloPlayerBuilder {
27:
28: /**
29: * Changes the name of the player.
30: * <p>
31: * There is no default.
32: *
33: * @param newName The name of the player.
34: * @return {@code this}
35: */
36: OthelloPlayerBuilder changeName(String newName);
37:
38: /**
39: * Determines whether the player is using black or white tokens.<
40: * <p>
41: * The default value if not called is {@code true}.
42: *
43: * @param newUsingBlackTokens If {@code true}, the player will be using black tokens, else she will be using white
44: * tokens.
45: * @return {@code this}
46: */
47: OthelloPlayerBuilder changeUsingBlackTokens(boolean newUsingBlackTokens);
48:
49: /**
50: * Returns {@code true} if this player builder uses the black tokens, and {@code false} if she uses the white
51: * tokens.
52: */
53: boolean isUsingBlackTokens();
54:
55: /**
56: * Builds the player.
57: *
58: * @return The Othello player.
59: * @throws GameException if creating the player is not allowed by the rules of the game.
60: */
61: OthelloPlayer build() throws GameException;
62: }