Skip to content

Package: VGBoard

VGBoard

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.ipspiel22.vierGewinnt.domain;
20:
21: import java.util.List;
22: import java.util.Map;
23:
24: import de.fhdw.gaming.core.domain.Stateful;
25:
26: /**
27: * Represents the Othello board.
28: * <p>
29: * An Othello board is a square and hence possesses an identical non-zero positive number of rows and columns. Each
30: * combination of a row and a column is described by a {@link VGPosition position}. At each position, there is a
31: * {@link VGField field} which describes whether the field is empty or occupied by a token.
32: */
33: public interface VGBoard extends Stateful {
34:
35: /**
36: * Returns the number of rows (or columns) of this board.
37: */
38: int getRows();
39:
40: /**
41: * Returns the number of rows (or columns) of this board.
42: */
43: int getColumns();
44:
45: /**
46: * Checks whether this board contains a field at the position passed.
47: *
48: * @param position The position.
49: * @return {@code true} if this board contains a field at the position passed, else {@code false}.
50: */
51: boolean hasFieldAt(VGPosition position);
52:
53: /**
54: * Returns the field at the given position.
55: *
56: * @param column The position of the field to return.
57: * @return The field.
58: * @throws IllegalArgumentException if the position is out of range, i.e. if it does not denote a field.
59: */
60: VGField getNextFieldInColumn(VGAnswerEnum column);
61:
62: /**
63: * Returns the field at the given position.
64: *
65: * @param position The position of the field to return.
66: * @return The field.
67: * @throws IllegalArgumentException if the position is out of range, i.e. if it does not denote a field.
68: */
69: VGField getFieldAt(VGPosition position);
70:
71: /**
72: * Returns all fields of this board column by column.
73: * <p>
74: * The list(s) returned are possibly immutable, so do not modify them.
75: */
76: List<List<? extends VGField>> getFields();
77:
78: /**
79: * Returns all fields of a given state.
80: * <p>
81: * The map returned returned is possibly immutable, so do not modify it.
82: *
83: * @param fieldState The state of the fields to return.
84: * @return The fields.
85: */
86: Map<VGPosition, ? extends VGField> getFieldsBeing(VGFieldState fieldState);
87:
88: @Override
89: VGBoard deepCopy();
90: }