package com.webtimer.timer;

import java.util.Timer;
import java.util.TimerTask;

public class CountdownTimer {

	private Timer timer;

	private int delay = 0;
	private int updateInterval = 1000;

	private int interval = 90000; //the countdown interval - default: 90 seconds
	static int countdown = 3000; //the time left over in the current interval
	boolean isRunning = false;

	boolean start(){
		timer = new Timer();
		timer.scheduleAtFixedRate(
				new TimerTask(){
					@Override
					public void run(){
						timeStep();
						System.out.println("Timer is at: " + String.valueOf(countdown));
					}
				},
				this.delay,
				this.updateInterval
				);
		isRunning=true;
		return isRunning;
	}

	boolean stop(){
		timer.cancel();
		isRunning=false;
		return isRunning;
	}

	private void timeStep(){
		/*
		 * Helper method to update the time left over in the current run.
		 * Reset interval when it runs out.
		 */
		if (countdown <= 0){
			countdown = interval;
		}
		countdown -= updateInterval;
	}
}

@@ -195,24 +195,31 @@
 ;%0A%0A%09private 
+static 
 int interval
@@ -276,16 +276,24 @@
 econds%0A%09
+private 
 static i
@@ -386,16 +386,361 @@
  false;%0A
+%09%0A%09/* GETTER AND SETTERS */%0A%09%0A%09public static int getInterval() %7B%0A%09%09return interval;%0A%09%7D%0A%0A%09public static void setInterval(int interval) %7B%0A%09%09CountdownTimer.interval = interval;%0A%09%7D%0A%0A%09public static int getCountdown() %7B%0A%09%09return countdown;%0A%09%7D%0A%0A%09public static void setCountdown(int countdown) %7B%0A%09%09CountdownTimer.countdown = countdown;%0A%09%7D%0A%09%0A%09/*METHODS*/
 %0A%09boolea

Refactor countdowntimer