]>
Commit | Line | Data |
---|---|---|
c6f3dff3 | 1 | package org.proofofconcept.shisensho; |
2 | ||
3 | class Point { | |
4 | public Point(int i, int j) { | |
5 | this.i=i; | |
6 | this.j=j; | |
7 | } | |
8 | ||
9 | public boolean equals(Point p) { | |
10 | return (i==p.i && j==p.j); | |
11 | } | |
12 | ||
13 | public String toString() { | |
14 | return "("+i+","+j+")"; | |
15 | } | |
16 | ||
17 | public static Point fromString(String s) { | |
18 | String[] ij=s.split(",",2); | |
19 | int i=Integer.parseInt(ij[0]); | |
20 | int j=Integer.parseInt(ij[1]); | |
21 | return new Point(i,j); | |
22 | } | |
23 | ||
24 | public int i; | |
25 | public int j; | |
26 | ||
27 | public Point copy() { | |
28 | return new Point(this.i,this.j); | |
29 | } | |
30 | } |