package terminal;

import com.googlecode.lanterna.TerminalSize;
import com.googlecode.lanterna.terminal.Terminal;
import com.googlecode.lanterna.terminal.virtual.VirtualTerminalListener;

public class FlushListener implements VirtualTerminalListener {

    private int flushCount;

    public FlushListener() {
        this.flushCount = 0;
    }

    public synchronized int getFlushCount() {
        return flushCount;
    }

    public synchronized void reduceFlushCount(int reduction) {
        flushCount -= reduction;
    }

    @Override
    public void onResized(Terminal terminal, TerminalSize newSize) {}

    @Override
    public synchronized void onFlush() {
        flushCount++;
        notify();
    }

    @Override
    public void onBell() {}

    @Override
    public void onClose() {}

}