1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package aigames.soccer.field;
21
22
23 /***
24 * @version $Id: FieldPoint.java,v 1.6 2004/05/08 21:55:25 mwerla Exp $
25 */
26 public class FieldPoint {
27 /*** There is no edge */
28 public static final int NO_EDGE = -2;
29
30 /*** The edge is field edge */
31 public static final int FIELD_EDGE = -1;
32
33 /*** The edge is blank edge */
34 public static final int BLANK_EDGE = 0;
35 private int[] edges;
36
37 /***
38 * Constructor which creates point with given edges.
39 * @param edges The edges to set.
40 */
41 public FieldPoint(int[] edges) {
42 this.edges = new int[4];
43
44 for (int i = 0; i < edges.length; i++) {
45 this.edges[i] = edges[i];
46 }
47 }
48
49 /***
50 * Default constructor which creates point without edges.
51 */
52 public FieldPoint() {
53 edges = new int[] { NO_EDGE, NO_EDGE, NO_EDGE, NO_EDGE };
54 }
55
56 /***
57 * Sets color of na edge.
58 * @param edgeNumber Edge to set color.
59 * @param color Color to set.
60 */
61 public void setEdgeColor(Integer edgeNumber, int color) {
62 setEdgeColor(edgeNumber.intValue(), color);
63 }
64
65 /***
66 * Sets color of na edge.
67 * @param edgeNumber Edge to set color.
68 * @param color Color to set.
69 */
70 public void setEdgeColor(int edgeNumber, int color) {
71 edges[edgeNumber - 1] = color;
72 }
73
74 /***
75 * Returns edge color for a given edge.
76 * @param edgeNumber Number of edge to check.
77 * @return Edge color.
78 */
79 public int getEdgeColor(int edgeNumber) {
80 return edges[edgeNumber - 1];
81 }
82 }