Skip to content

Package: MemoryObserverImpl

MemoryObserverImpl

nameinstructionbranchcomplexitylinemethod
MemoryObserverImpl()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
finished(Game, State)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
illegalMoveRejected(Game, State, Player, Optional, String)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
illegalPlayerRejected(Game, State, Player)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
legalMoveApplied(Game, State, Player, Move)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
nextPlayersComputed(Game, State, Set)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
overdueMoveRejected(Game, State, Player, Optional)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
playerOvertaken(Game, State, Player, Player)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
playerResigned(Game, State, Player)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
started(Game, State)
M: 1 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: package de.fhdw.gaming.memory.impl;
2:
3: import java.util.Optional;
4: import java.util.Set;
5:
6: import de.fhdw.gaming.core.domain.Game;
7: import de.fhdw.gaming.core.domain.Move;
8: import de.fhdw.gaming.core.domain.Observer;
9: import de.fhdw.gaming.core.domain.Player;
10: import de.fhdw.gaming.core.domain.State;
11:
12: /**
13: * An observer implementation that interacts with the memory brain to remember game outcomes.
14: */
15: public class MemoryObserverImpl implements Observer {
16:
17: @Override
18: public void started(Game<?, ?, ?, ?> game, State<?, ?> state) throws InterruptedException {
19: // Not implemented
20: }
21:
22: @Override
23: public void nextPlayersComputed(Game<?, ?, ?, ?> game, State<?, ?> state, Set<? extends Player<?>> players)
24: throws InterruptedException {
25: // Not implemented
26: }
27:
28: @Override
29: public void illegalPlayerRejected(Game<?, ?, ?, ?> game, State<?, ?> state, Player<?> player)
30: throws InterruptedException {
31: // Not implemented
32: }
33:
34: @Override
35: public void legalMoveApplied(Game<?, ?, ?, ?> game, State<?, ?> state, Player<?> player, Move<?, ?> move)
36: throws InterruptedException {
37: // Not implemented
38: }
39:
40: @Override
41: public void illegalMoveRejected(Game<?, ?, ?, ?> game, State<?, ?> state, Player<?> player,
42: Optional<Move<?, ?>> move, String reason) throws InterruptedException {
43: // Not implemented
44: }
45:
46: @Override
47: public void overdueMoveRejected(Game<?, ?, ?, ?> game, State<?, ?> state, Player<?> player,
48: Optional<Move<?, ?>> chosenMove) throws InterruptedException {
49: // Not implemented
50: }
51:
52: @Override
53: public void playerResigned(Game<?, ?, ?, ?> game, State<?, ?> state, Player<?> player) throws InterruptedException {
54: // Not implemented
55: }
56:
57: @Override
58: public void playerOvertaken(Game<?, ?, ?, ?> game, State<?, ?> state, Player<?> overtakenPlayer,
59: Player<?> overtakingPlayer) throws InterruptedException {
60: // Not implemented
61: }
62:
63: /**
64: * Every time a game finished the outcome will be remembered by the brain.
65: */
66: @Override
67: public void finished(Game<?, ?, ?, ?> game, State<?, ?> state) throws InterruptedException {
68: MemoryBrainImpl.getInstance().rememberOutcome(game);
69: }
70:
71: }