Source code: com/adorphuye/othello/gui/board/BoardEvent.java
1 package com.adorphuye.othello.gui.board;
2
3 import com.adorphuye.othello.player.*;
4 import java.util.EventObject;
5 import java.awt.Point;
6
7 public class BoardEvent
8 {
9 public static final int NONE = -1;
10 public static final int WILLPLAY = 0;
11 public static final int PLAYING = 1;
12 public static final int HASPLAYED = 2;
13 public static final int PIECEUPDATE = 3;
14 public static final int REFRESH = 99;
15
16 private int type = NONE;
17 private Player player = null;
18 private Point point = null;
19 private Player oldPlayer= null;
20
21 /**
22 * @param eventType
23 * @param old
24 * @param play
25 * @param p */
26 public BoardEvent(int eventType, Player old, Player play, Point p)
27 {
28 setType(eventType);
29 setOldPlayer(old);
30 setPlayer(play);
31 setPoint(p);
32 }
33
34 /**
35 * @param p */
36 public void setOldPlayer(Player p)
37 {
38 oldPlayer = p;
39 }
40
41 /**
42 * @return */
43 public Player getOldPlayer()
44 {
45 return oldPlayer;
46 }
47
48 /**
49 * @param p */
50 public void setPoint(Point p)
51 {
52 point = p;
53 }
54
55 /**
56 * @return */
57 public Point getPoint()
58 {
59 return point;
60 }
61
62 /**
63 * @param play */
64 public void setPlayer(Player play)
65 {
66 player = play;
67 }
68
69 /**
70 * @return */
71 public Player getPlayer()
72 {
73 return player;
74 }
75
76 /**
77 * @param t */
78 public void setType(int t)
79 {
80 type = t;
81 }
82
83 /**
84 * @return */
85 public int getType()
86 {
87 return type;
88 }
89 }