package meerkat.voting.gui.ui;

import meerkat.voting.gui.ui.uicommands.TickCommand;
import meerkat.voting.gui.ui.uicommands.UICommand;

import java.util.TimerTask;

/**
 * A thread that sends the UI clock TickCommands in a given constant frequency
 */
public class TickerTimerTask extends TimerTask {
    private CommandPend<UICommand> cmdPend;
    public TickerTimerTask (CommandPend<UICommand> cmdPend) {
        this.cmdPend = cmdPend;
    }

    @Override
    public void run() {
        cmdPend.offer(new TickCommand(null));
    }
}
