Skip to content

Package: C4Position

C4Position

nameinstructionbranchcomplexitylinemethod
C4Position(int, int)
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
equals(Object)
M: 0 C: 22
100%
M: 0 C: 6
100%
M: 0 C: 4
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
getColumn()
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%
getRow()
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%
hashCode()
M: 0 C: 16
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
toString()
M: 0 C: 17
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: package de.fhdw.gaming.ipspiel23.c4.domain.impl;
2:
3: import de.fhdw.gaming.ipspiel23.c4.domain.IC4Position;
4:
5: /**
6: * Represents a position on the connect four board.
7: */
8: public class C4Position implements IC4Position {
9:
10: /**
11: * The zero-based row index of this position.
12: */
13: private final int row;
14:
15: /**
16: * The zero-based column index of this position.
17: */
18: private final int column;
19:
20: /**
21: * Creates a new instance of {@link C4Position}.
22: * @param rowIndex The zero-based row index of this position.
23: * @param columnIndex The zero-based column index of this position.
24: */
25: public C4Position(final int rowIndex, final int columnIndex) {
26: this.row = rowIndex;
27: this.column = columnIndex;
28: }
29:
30: @Override
31: public int getRow() {
32: return this.row;
33: }
34:
35: @Override
36: public int getColumn() {
37: return this.column;
38: }
39:
40: @Override
41: public boolean equals(final Object obj) {
42:• if (obj instanceof IC4Position) {
43: final IC4Position other = (IC4Position) obj;
44:• return this.row == other.getRow() && this.column == other.getColumn();
45: }
46: return false;
47: }
48:
49: @Override
50: public int hashCode() {
51: int hash = 17 * 31;
52: hash += this.row;
53: hash = hash * 31 + this.column;
54: return hash;
55: }
56:
57: @Override
58: public String toString() {
59: return String.format("C4Position(row: %d, column: %d)", this.row, this.column);
60: }
61: }