package tinj.jcdv.wpky;

import java.util.ArrayList;
import java.util.List;

public class Mmlp {
    private static Mmlp sInstance;
    private List<Mxtk> mPhotoList;

    private Mmlp() {
        mPhotoList = new ArrayList<>();
    }

    public static synchronized Mmlp getInstance() {
        if (sInstance == null) {
            sInstance = new Mmlp();
        }
        return sInstance;
    }

    public void addPhoto(Mxtk photo) {
        if (!mPhotoList.contains(photo)) {
            boolean mBoolean = mPhotoList.add(photo);
        }
    }

    public void removePhoto(Mxtk photo) {
        if (mPhotoList.contains(photo)) {
            boolean mBoolean = mPhotoList.remove(photo);
        }
    }

    public void clearCache() {
        if(!mPhotoList.isEmpty()){
            mPhotoList.clear();
        }

    }

    public List<Mxtk> getPhotoList() {
        return mPhotoList;
    }

    public Mxtk getPositionData(int position) {
        if (position >= 0 && position < mPhotoList.size()) {
            return mPhotoList.get(position);
        } else {
            return null;
        }
    }

    public int getCount() {

        return mPhotoList.size();
    }
}
