forked from MrBly/WalnutiQ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathColumnPosition.java
63 lines (56 loc) · 1.84 KB
/
ColumnPosition.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package model.MARK_II;
/**
* Represents the position of a Column within a Region.
*
* @author Quinn Liu ([email protected])
* @version June 18, 2013
*/
public class ColumnPosition {
private int row; // row position within Region
private int column; // column position within Region
public ColumnPosition(int row, int column) {
if (row < 0) {
throw new IllegalArgumentException(
"row in ColumnPosition class constructor cannot be < 0");
} else if (column < 0) {
throw new IllegalArgumentException(
"column in ColumnPosition class constructor cannot be < 0");
}
this.row = row;
this.column = column;
}
public int getRow() {
return this.row;
}
public int getColumn() {
return this.column;
}
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("\n=======================");
stringBuilder.append("\n--ColumnPosition Info--");
stringBuilder.append("\n(row, column): ");
stringBuilder.append("(" + this.row + ", " + this.column + ")");
stringBuilder.append("\n=======================");
String visionCellInformation = stringBuilder.toString();
return visionCellInformation;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + this.row;
result = prime * result + this.column;
return result;
}
@Override
public boolean equals(Object obj) {
ColumnPosition otherColumnPosition = (ColumnPosition) obj;
if (this.row != otherColumnPosition.row)
return false;
if (this.column != otherColumnPosition.column)
return false;
return true;
}
}