summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/control
diff options
context:
space:
mode:
Diffstat (limited to 'src/jrummikub/control')
-rw-r--r--src/jrummikub/control/ITurnTimer.java13
-rw-r--r--src/jrummikub/control/TurnControl.java2
-rw-r--r--src/jrummikub/control/TurnTimer.java8
3 files changed, 21 insertions, 2 deletions
diff --git a/src/jrummikub/control/ITurnTimer.java b/src/jrummikub/control/ITurnTimer.java
new file mode 100644
index 0000000..54f00b5
--- /dev/null
+++ b/src/jrummikub/control/ITurnTimer.java
@@ -0,0 +1,13 @@
+package jrummikub.control;
+
+import jrummikub.util.IEvent;
+
+public interface ITurnTimer {
+
+ public abstract void startTimer();
+
+ public abstract void stopTimer();
+
+ public abstract IEvent getTimeRunOutEvent();
+
+} \ No newline at end of file
diff --git a/src/jrummikub/control/TurnControl.java b/src/jrummikub/control/TurnControl.java
index ba2c0bb..c994ca1 100644
--- a/src/jrummikub/control/TurnControl.java
+++ b/src/jrummikub/control/TurnControl.java
@@ -10,7 +10,7 @@ import jrummikub.view.IView;
public class TurnControl {
private Hand hand;
private ITable table;
- private TurnTimer timer;
+ private ITurnTimer timer;
private IView view;
private Event endOfTurnEvent = new Event();
diff --git a/src/jrummikub/control/TurnTimer.java b/src/jrummikub/control/TurnTimer.java
index 9e694f7..789bf1a 100644
--- a/src/jrummikub/control/TurnTimer.java
+++ b/src/jrummikub/control/TurnTimer.java
@@ -9,7 +9,7 @@ import jrummikub.util.Event;
import jrummikub.util.IEvent;
import jrummikub.view.IView;
-public class TurnTimer implements ActionListener {
+public class TurnTimer implements ActionListener, ITurnTimer {
private IView view;
private int timeLeft = 60;
private Timer timer;
@@ -23,14 +23,19 @@ public class TurnTimer implements ActionListener {
view.getPlayerPanel().setTimeLeft(timeLeft);
}
+
+ @Override
public void startTimer() {
timer.start();
}
+
+ @Override
public void stopTimer() {
timer.stop();
}
+
@Override
public void actionPerformed(ActionEvent arg0) {
timeLeft--;
@@ -41,6 +46,7 @@ public class TurnTimer implements ActionListener {
}
}
+ @Override
public IEvent getTimeRunOutEvent() {
return timeRunOutEvent;
}