Skip to content

Package: TicTacToeRow

TicTacToeRow

Coverage

1: /*
2: * Copyright © 2021 Fachhochschule für die Wirtschaft (FHDW) Hannover
3: *
4: * This file is part of ipspiel21-tictactoe-core.
5: *
6: * ipspiel21-tictactoe-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: * ipspiel21-tictactoe-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: * ipspiel21-tictactoe-core. If not, see <http://www.gnu.org/licenses/>.
18: */
19: package de.fhdw.gaming.ipspiel21.tictactoe.core.domain;
20:
21: import java.util.List;
22: import java.util.Optional;
23:
24: /**
25: * Represents a complete row on a {@link TicTacToeBoard board}.
26: */
27: public interface TicTacToeRow {
28:
29: /**
30: * Returns the type of this row.
31: */
32: TicTacToeRowType getType();
33:
34: /**
35: * Returns the index of this row. For horizontal or vertical rows, its range extends from zero to the number of
36: * rows/columns minus one. For diagonal rows, only zero (main diagonal) or one (secondary diagonal) are possible.
37: */
38: int getIndex();
39:
40: /**
41: * Returns a row state if all fields in this row possess the same field state. Note that this also includes the
42: * state {@link TicTacToeFieldState#EMPTY}.
43: */
44: Optional<TicTacToeFieldState> getState();
45:
46: /**
47: * Returns the fields of this row.
48: */
49: List<? extends TicTacToeField> getFields();
50: }