package net.liquidpineapple.pang.runnables;

import net.liquidpineapple.pang.gui.Board;
import net.liquidpineapple.pang.gui.LifeSystem;
import net.liquidpineapple.pang.gui.ScoreSystem;
import net.liquidpineapple.pang.logger.Logger;

/**
 * @author Jurriaan Den Toonder Created on 25-10-16
 */
public class UpdateRunnable implements Runnable {

  // Class constants
  private static final int UPDATE_DELAY = 10;

  // Class fields
  private Board board;
  private ScoreSystem scoreSystem;
  private LifeSystem lifeSystem;

  // Thread running boolean
  private volatile boolean running = true;

  public UpdateRunnable(Board board, ScoreSystem scoreSystem, LifeSystem lifeSystem) {
    this.board = board;
    this.scoreSystem = scoreSystem;
    this.lifeSystem = lifeSystem;
  }

  @Override
  public void run() {
    long beforeTime;
    long timeDiff;
    long sleep;

    beforeTime = System.currentTimeMillis();
    Logger.info("Update loop is running");

    while (running) {
      timeDiff = System.currentTimeMillis() - beforeTime;
      sleep = UPDATE_DELAY - timeDiff;

      if (sleep < 0) {
        sleep = 2;
      }

      board.getCurrentScreen().doUpdate();
      scoreSystem.displayscore();
      lifeSystem.updateLifes();

      beforeTime = System.currentTimeMillis();

      try {
        Thread.sleep(sleep);
      } catch (InterruptedException exception) {
        Logger.info("Interrupted: " + exception.getMessage());
        running = false;
      }
    }
    Logger.info("Update Runnable stopped");
  }

  public void terminate() {
    this.running = false;
  }
}

@@ -230,16 +230,105 @@
 r;%0A%0A/**%0A
+ * The runnable for the update loop of the %7B@link net.liquidpineapple.pang.Application%7D.%0A
  * @auth
@@ -676,16 +676,207 @@
  true;%0A%0A
+  /**%0A   * Constructor for the %7B@link UpdateRunnable%7D.%0A   * @param board The %7B@link Board%7D%0A   * @param scoreSystem The %7B@link ScoreSystem%7D%0A   * @param lifeSystem The %7B@link LifeSystem%7D%0A   */%0A
   public

Fix checkstyle in UpdateRunnable