-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTicker.java
More file actions
26 lines (22 loc) · 726 Bytes
/
Ticker.java
File metadata and controls
26 lines (22 loc) · 726 Bytes
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
public abstract class Ticker {
long startTime, length, startDelay;
public Ticker(long tick, long len, long sDelay) {
startTime = tick;
length = len;
startDelay = sDelay;
}
public void register(TickerController controller) {
controller.registerTicker(this);
preAction();
}
public void update(long newTick) {
duringAction();
if(newTick == length + startTime) {
System.out.println("Ticker complete");
postAction();
}
}
public abstract void preAction();
public abstract void duringAction(); // happens each tick while it runs
public abstract void postAction(); // happens once after it completes
}