package dealertimer;
public class DealerTimer
implements Runnable {
private static final String[] LEVELS
;
static {
LEVELS[0] = "25/50";
LEVELS[1] = "50/100";
LEVELS[2] = "100/200";
LEVELS[3] = "150/300";
LEVELS[4] = "200/400";
LEVELS[5] = "300/600";
LEVELS[6] = "400/800";
LEVELS[7] = "500/1000";
LEVELS[8] = "600/1200";
LEVELS[9] = "800/1600";
LEVELS[10] = "1000/2000";
LEVELS[11] = "1500/3000";
LEVELS[12] = "2000/4000";
LEVELS[13] = "3000/6000";
LEVELS[14] = "4000/8000";
LEVELS[15] = "6000/12K";
LEVELS[16] = "8000/16K";
LEVELS[17] = "10K/20K";
LEVELS[18] = "15K/30K";
LEVELS[19] = "20K/40K";
LEVELS[20] = "30K/60K";
LEVELS[21] = "40K/80K";
LEVELS[22] = "50K/100K";
LEVELS[23] = "60K/120K";
LEVELS[24] = "80K/160K";
LEVELS[25] = "100K/200K";
LEVELS[26] = "150K/300K";
LEVELS[27] = "200K/400K";
LEVELS[28] = "300K/600K";
}
private int level;
private int second;
private int seconds;
private boolean pause;
private boolean stop;
public DealerTimer() {
this.seconds = 0;
this.pause = true;
this.stop = true;
this.level = 0;
}
public void addMinute() {
this.second += 60;
this.seconds += 60;
}
public int getMinutes() {
return this.second / 60;
}
public int getSeconds() {
return this.second - 60 * (this.getMinutes());
}
return DealerTimer.LEVELS[this.level];
}
public void run() {
while (!this.stop) {
try {
if (this.second <= 0 && this.seconds != 0) {
this.second = this.seconds;
if(this.level+1<DealerTimer.LEVELS.length){
this.level++;
}
} else if (!this.pause && !this.stop && this.seconds != 0) {
this.second--;
}
ex.printStackTrace();
}
}
}
public void start() {
if (this.stop) {
this.
start = new Thread(this);
this.pause = false;
this.stop = false;
this.start.start();
} else {
this.stop();
}
}
public void pause() {
this.pause = !this.pause;
}
public void reset() {
this.seconds = 0;
this.second = 0;
}
public boolean getStop() {
return this.stop;
}
public boolean getPause() {
return this.pause;
}
private void stop() {
this.stop = true;
this.second = this.seconds;
this.level = 0;
}
public boolean isEndeed() {
if (this.second == 0 && !this.stop && !this.pause && this.seconds != 0) {
return true;
}
return false;
}
}