Skip to content

Package: OthelloFieldState$1

OthelloFieldState$1

nameinstructionbranchcomplexitylinemethod
inverse()
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
toString()
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
{...}
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /*
2: * Copyright © 2020-2023 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: /**
22: * Represents the state of a field.
23: */
24: public enum OthelloFieldState {
25:
26: /**
27: * The field is empty.
28: */
29: EMPTY {
30: @Override
31: public OthelloFieldState inverse() {
32: return this;
33: }
34:
35: @Override
36: public String toString() {
37: return "empty";
38: }
39: },
40:
41: /**
42: * There is a black token on the field.
43: */
44: BLACK {
45: @Override
46: public OthelloFieldState inverse() {
47: return WHITE;
48: }
49:
50: @Override
51: public String toString() {
52: return "black";
53: }
54: },
55:
56: /**
57: * There is a white token on the field.
58: */
59: WHITE {
60: @Override
61: public OthelloFieldState inverse() {
62: return BLACK;
63: }
64:
65: @Override
66: public String toString() {
67: return "white";
68: }
69: };
70:
71: /**
72: * Returns the inverse of the field state. {@link #EMPTY} transforms into itself.
73: */
74: public abstract OthelloFieldState inverse();
75:
76: @Override
77: public abstract String toString();
78: }