BotStatistics.java

1
package com.takenoko.stats;
2
3
import com.takenoko.engine.BotManager;
4
import java.util.HashMap;
5
import java.util.List;
6
7
/** This class stores extended statistics for each BotManager */
8
public class BotStatistics extends HashMap<BotManager, SingleBotStatistics> {
9
10
    public void addBotManager(BotManager botManager) {
11
        this.put(botManager, botManager.getSingleBotStatistics());
12
    }
13
14
    public void addBotManagers(List<BotManager> botManagers) {
15
        for (BotManager botManager : botManagers) {
16 1 1. addBotManagers : removed call to com/takenoko/stats/BotStatistics::addBotManager → KILLED
            addBotManager(botManager);
17
        }
18
    }
19
20
    public void incrementWins(BotManager botManager) {
21 1 1. incrementWins : removed call to com/takenoko/stats/SingleBotStatistics::incrementWins → TIMED_OUT
        get(botManager).incrementWins();
22
    }
23
24
    public void incrementLosses(BotManager botManager) {
25 1 1. incrementLosses : removed call to com/takenoko/stats/SingleBotStatistics::incrementLosses → TIMED_OUT
        get(botManager).incrementLosses();
26
    }
27
28
    public void updateScore(BotManager botManager, int toAdd) {
29 1 1. updateScore : removed call to com/takenoko/stats/SingleBotStatistics::updateScore → TIMED_OUT
        get(botManager).updateScore(toAdd);
30
    }
31
32
    @Override
33
    public String toString() {
34
        StringBuilder fullStats = new StringBuilder();
35
        String lineJump = "\n \t \t \t";
36
        for (BotManager botManager : this.keySet()) {
37
            fullStats
38
                    .append("===========")
39
                    .append(botManager)
40
                    .append("===========")
41
                    .append(lineJump)
42
                    .append(get(botManager))
43
                    .append(lineJump);
44
        }
45 1 1. toString : replaced return value with "" for com/takenoko/stats/BotStatistics::toString → TIMED_OUT
        return fullStats.toString();
46
    }
47
}

Mutations

16

1.1
Location : addBotManagers
Killed by : com.takenoko.engine.GameEngineTest.[engine:junit-jupiter]/[class:com.takenoko.engine.GameEngineTest]/[nested-class:TestEndGame]/[method:endGame_shouldDisplayALotOfMessages()]
removed call to com/takenoko/stats/BotStatistics::addBotManager → KILLED

21

1.1
Location : incrementWins
Killed by : none
removed call to com/takenoko/stats/SingleBotStatistics::incrementWins → TIMED_OUT

25

1.1
Location : incrementLosses
Killed by : none
removed call to com/takenoko/stats/SingleBotStatistics::incrementLosses → TIMED_OUT

29

1.1
Location : updateScore
Killed by : none
removed call to com/takenoko/stats/SingleBotStatistics::updateScore → TIMED_OUT

45

1.1
Location : toString
Killed by : none
replaced return value with "" for com/takenoko/stats/BotStatistics::toString → TIMED_OUT

Active mutators

Tests examined


Report generated by PIT 1.8.0