Door.java

1
package g0803.bindingofshiba.model.game.room;
2
3
import g0803.bindingofshiba.math.Vec2D;
4
5
public class Door {
6
7
    private Room originRoom;
8
    private Room destinationRoom;
9
    private DoorPosition originPosition;
10
    private DoorPosition destinationPosition;
11
    private boolean isUnlocked = false;
12
13
    public Vec2D getPositionByWall(Room room) {
14 2 1. getPositionByWall : negated conditional → KILLED
2. getPositionByWall : negated conditional → KILLED
        if (room != originRoom && room != destinationRoom) {
15
            throw new IllegalArgumentException("Room is not origin nor destination");
16
        }
17
18
        DoorPosition position = getDoorPosition(room);
19 1 1. getPositionByWall : replaced return value with null for g0803/bindingofshiba/model/game/room/Door::getPositionByWall → KILLED
        return switch (position) {
20 1 1. getPositionByWall : Replaced integer division with multiplication → KILLED
            case TOP -> new Vec2D(room.getWidth() / 2, 1);
21 2 1. getPositionByWall : Replaced integer division with multiplication → KILLED
2. getPositionByWall : Replaced integer subtraction with addition → KILLED
            case BOTTOM -> new Vec2D(room.getWidth() / 2, room.getHeight() - 2);
22 2 1. getPositionByWall : Replaced integer subtraction with addition → KILLED
2. getPositionByWall : Replaced integer division with multiplication → KILLED
            case RIGHT -> new Vec2D(room.getWidth() - 2, room.getHeight() / 2);
23 1 1. getPositionByWall : Replaced integer division with multiplication → KILLED
            case LEFT -> new Vec2D(1, room.getHeight() / 2);
24
        };
25
    }
26
27
    public Door(
28
            Room origin,
29
            DoorPosition originPosition,
30
            Room destination,
31
            DoorPosition destinationPosition) {
32
        this.originRoom = origin;
33
        this.originPosition = originPosition;
34
        this.destinationRoom = destination;
35
        this.destinationPosition = destinationPosition;
36
    }
37
38
    public Room getOriginRoom() {
39 1 1. getOriginRoom : replaced return value with null for g0803/bindingofshiba/model/game/room/Door::getOriginRoom → KILLED
        return this.originRoom;
40
    }
41
42
    public DoorPosition getOriginPosition() {
43 1 1. getOriginPosition : replaced return value with null for g0803/bindingofshiba/model/game/room/Door::getOriginPosition → KILLED
        return this.originPosition;
44
    }
45
46
    public Room getDestinationRoom() {
47 1 1. getDestinationRoom : replaced return value with null for g0803/bindingofshiba/model/game/room/Door::getDestinationRoom → KILLED
        return this.destinationRoom;
48
    }
49
50
    public DoorPosition getDestinationPosition() {
51 1 1. getDestinationPosition : replaced return value with null for g0803/bindingofshiba/model/game/room/Door::getDestinationPosition → SURVIVED
        return this.destinationPosition;
52
    }
53
54
    public DoorPosition getDoorPosition(Room room) {
55 2 1. getDoorPosition : negated conditional → KILLED
2. getDoorPosition : replaced return value with null for g0803/bindingofshiba/model/game/room/Door::getDoorPosition → KILLED
        return room == originRoom ? originPosition : destinationPosition;
56
    }
57
58
    public Room getOtherRoom(Room room) {
59 2 1. getOtherRoom : negated conditional → KILLED
2. getOtherRoom : replaced return value with null for g0803/bindingofshiba/model/game/room/Door::getOtherRoom → KILLED
        return room == destinationRoom ? originRoom : destinationRoom;
60
    }
61
62
    public boolean getUnlocked() {
63 2 1. getUnlocked : replaced boolean return with false for g0803/bindingofshiba/model/game/room/Door::getUnlocked → KILLED
2. getUnlocked : replaced boolean return with true for g0803/bindingofshiba/model/game/room/Door::getUnlocked → KILLED
        return this.isUnlocked;
64
    }
65
66
    public void unlock() {
67
        this.isUnlocked = true;
68
    }
69
}

Mutations

14

1.1
Location : getPositionByWall
Killed by : g0803.bindingofshiba.model.game.room.DoorTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.room.DoorTest]/[method:getPositionByWall()]
negated conditional → KILLED

2.2
Location : getPositionByWall
Killed by : g0803.bindingofshiba.model.game.room.DoorTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.room.DoorTest]/[method:getPositionByWall()]
negated conditional → KILLED

19

1.1
Location : getPositionByWall
Killed by : g0803.bindingofshiba.model.game.room.DoorTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.room.DoorTest]/[method:getPositionByWall()]
replaced return value with null for g0803/bindingofshiba/model/game/room/Door::getPositionByWall → KILLED

20

1.1
Location : getPositionByWall
Killed by : g0803.bindingofshiba.model.game.room.DoorTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.room.DoorTest]/[method:getPositionByWall()]
Replaced integer division with multiplication → KILLED

21

1.1
Location : getPositionByWall
Killed by : g0803.bindingofshiba.model.game.room.DoorTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.room.DoorTest]/[method:getPositionByWall2()]
Replaced integer division with multiplication → KILLED

2.2
Location : getPositionByWall
Killed by : g0803.bindingofshiba.model.game.room.DoorTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.room.DoorTest]/[method:getPositionByWall2()]
Replaced integer subtraction with addition → KILLED

22

1.1
Location : getPositionByWall
Killed by : g0803.bindingofshiba.model.game.room.DoorTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.room.DoorTest]/[method:getPositionByWall()]
Replaced integer subtraction with addition → KILLED

2.2
Location : getPositionByWall
Killed by : g0803.bindingofshiba.model.game.room.DoorTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.room.DoorTest]/[method:getPositionByWall()]
Replaced integer division with multiplication → KILLED

23

1.1
Location : getPositionByWall
Killed by : g0803.bindingofshiba.model.game.room.DoorTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.room.DoorTest]/[method:getPositionByWall2()]
Replaced integer division with multiplication → KILLED

39

1.1
Location : getOriginRoom
Killed by : g0803.bindingofshiba.model.game.room.DoorTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.room.DoorTest]/[method:getOtherRoom()]
replaced return value with null for g0803/bindingofshiba/model/game/room/Door::getOriginRoom → KILLED

43

1.1
Location : getOriginPosition
Killed by : g0803.bindingofshiba.model.game.room.RoomTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.room.RoomTest]/[method:addDoor()]
replaced return value with null for g0803/bindingofshiba/model/game/room/Door::getOriginPosition → KILLED

47

1.1
Location : getDestinationRoom
Killed by : g0803.bindingofshiba.model.game.room.DoorTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.room.DoorTest]/[method:getOtherRoom()]
replaced return value with null for g0803/bindingofshiba/model/game/room/Door::getDestinationRoom → KILLED

51

1.1
Location : getDestinationPosition
Killed by : none
replaced return value with null for g0803/bindingofshiba/model/game/room/Door::getDestinationPosition → SURVIVED

55

1.1
Location : getDoorPosition
Killed by : g0803.bindingofshiba.model.game.room.DoorTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.room.DoorTest]/[method:getPositionByWall()]
negated conditional → KILLED

2.2
Location : getDoorPosition
Killed by : g0803.bindingofshiba.model.game.room.DoorTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.room.DoorTest]/[method:getPositionByWall()]
replaced return value with null for g0803/bindingofshiba/model/game/room/Door::getDoorPosition → KILLED

59

1.1
Location : getOtherRoom
Killed by : g0803.bindingofshiba.model.game.room.DoorTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.room.DoorTest]/[method:getOtherRoom()]
negated conditional → KILLED

2.2
Location : getOtherRoom
Killed by : g0803.bindingofshiba.model.game.room.DoorTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.model.game.room.DoorTest]/[method:getOtherRoom()]
replaced return value with null for g0803/bindingofshiba/model/game/room/Door::getOtherRoom → KILLED

63

1.1
Location : getUnlocked
Killed by : g0803.bindingofshiba.controller.game.RoomControllerTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.controller.game.RoomControllerTest]/[method:tick2()]
replaced boolean return with false for g0803/bindingofshiba/model/game/room/Door::getUnlocked → KILLED

2.2
Location : getUnlocked
Killed by : g0803.bindingofshiba.view.game.RoomViewTest.[engine:junit-jupiter]/[class:g0803.bindingofshiba.view.game.RoomViewTest]/[method:blitsDoorClosed()]
replaced boolean return with true for g0803/bindingofshiba/model/game/room/Door::getUnlocked → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.0