-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPair.java
43 lines (35 loc) · 966 Bytes
/
Pair.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
import java.io.Serializable;
public class Pair implements Serializable
{
private static final long serialVersionUID = 1L;
private Move m;
private Move pm;
public Pair(Move m, Move pM)
{
this.m = m;
this.pm = pM;
}
public Pair(Pair p)
{
this.m = new Move(p.getMove());
this.pm = new Move(p.getPrevMove());
}
public boolean equals(Object m)
{
Pair pair = new Pair((Pair)m);
return ((this.getMove().getRow() == pair.getMove().getRow() && this.getMove().getColumn() == pair.getMove().getColumn())
&& (this.getPrevMove().getRow() == pair.getPrevMove().getRow() && this.getPrevMove().getColumn() == pair.getPrevMove().getColumn()));
}
public Move getMove()
{
return this.m;
}
public Move getPrevMove()
{
return this.pm;
}
public String toString()
{
return "[" + this.m.getRow() + "," + this.m.getColumn() + "]" + "[" + this.pm.getRow() + "," + this.pm.getColumn() + "]";
}
}