package fanch.multijeu.findwords.data.checker;

import java.util.ArrayList;

import fanch.multijeu.findwords.data.dictionaire.Dictionaire;

public class SimpleWordCheckerList extends AbstractWordCheckerList {

    protected ArrayList<WordChecker> mCheecker = new ArrayList<>();
    protected int                    mIndex=-1;

    public SimpleWordCheckerList(Dictionaire d, ArrayList<String> c)
    {
        super(null);
        add(d,c);
    }

    public SimpleWordCheckerList(Dictionaire d, ArrayList<String> c, WordChecker.Attrs a)
    {
        super(a);
        add(d,c);
    }

    public SimpleWordCheckerList(Dictionaire d, String[] c)
    {
        super(null);
        add(d,c);
    }

    public SimpleWordCheckerList(Dictionaire d, String c)
    {
        super(null);
        add(d,c);
    }

    public SimpleWordCheckerList(Dictionaire d, String[] c, WordChecker.Attrs a)
    {
        super(a);
        add(d,c);
    }

    public SimpleWordCheckerList(Dictionaire d, String c, WordChecker.Attrs a)
    {
        super(a);
        add(d,c);
    }



    public void add(Dictionaire d, String wc)
    {

        mCheecker.add(new WordChecker(d, wc, mAttrs));
    }

    public void add(Dictionaire d, String[] c)
    {
        for(int i=0; i<c.length; i++)
            add(d,c[i]);
    }

    public void add(Dictionaire d, ArrayList<String> c)
    {
        for(int i=0; i<c.size(); i++)
           add(d,c.get(i));
    }

    @Override
    public WordChecker next(Dictionaire d) {
        ++mIndex;
        return peek();
    }

    @Override
    public WordChecker peek() {
        return mCheecker.get(mIndex);
    }

    @Override
    public boolean hasNext() {
        return mIndex+1<mCheecker.size();
    }

    @Override
    public void reset() {
        mIndex=-1;
    }
}
