package chaoran.business.adapter;

/*
 **********************************************
 *      DATE           PERSON       REASON
 *    2021-02-01          FXY        Created
 **********************************************
 */


import chaoran.business.activity.ResultListener;

import static java.lang.Thread.sleep;

public class TestAdapter implements Adapter {

    private ResultListener resultListener;

    public TestAdapter(ResultListener resultListener) {
        this.resultListener = resultListener;
    }

    @Override
    public void start() {
        new Thread(() -> {
            int i = 0;
            while (i < 10) {
                resultListener.result(i + "");
                i++;
                try {
                    sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }

        }).start();
    }

    @Override
    public void stop() {

    }
}
