package epson.print.imgsel;

import java.util.ArrayList;
import java.util.Comparator;

class ImageFolderInfo {
    public static final int IMAGE_ID_MAX = 4;
    public String mCanonicalName;
    private int mImageCount;
    private ArrayList<Long> mImageIdList = new ArrayList<>();
    private ArrayList<String> mImageNameList = new ArrayList<>();
    private int mMiniDatabaseOrder;

    public ImageFolderInfo(String str) {
        this.mCanonicalName = str;
        this.mMiniDatabaseOrder = -1;
    }

    public boolean addImageLastIfPossible(long j, String str, int i) {
        if (this.mMiniDatabaseOrder < 0) {
            this.mMiniDatabaseOrder = i;
        }
        this.mImageCount++;
        if (this.mImageIdList.size() >= 4) {
            return false;
        }
        this.mImageIdList.add(Long.valueOf(j));
        this.mImageNameList.add(str);
        return true;
    }

    public long getId(int i) {
        if (i >= this.mImageIdList.size() || i < 0) {
            return -1;
        }
        return this.mImageIdList.get(i).longValue();
    }

    public String getFileName(int i) {
        if (i >= this.mImageNameList.size() || i < 0) {
            return null;
        }
        return this.mImageNameList.get(i);
    }

    public int getFileIdCount() {
        return this.mImageIdList.size();
    }

    public int getImageCount() {
        return this.mImageCount;
    }

    public int getMiniDatabaseOrder() {
        return this.mMiniDatabaseOrder;
    }

    static class DatabaseOrderComparator implements Comparator<ImageFolderInfo> {
        DatabaseOrderComparator() {
        }

        public int compare(ImageFolderInfo imageFolderInfo, ImageFolderInfo imageFolderInfo2) {
            int miniDatabaseOrder = imageFolderInfo.getMiniDatabaseOrder();
            int miniDatabaseOrder2 = imageFolderInfo2.getMiniDatabaseOrder();
            if (miniDatabaseOrder > miniDatabaseOrder2) {
                return 1;
            }
            return miniDatabaseOrder == miniDatabaseOrder2 ? 0 : -1;
        }
    }
}
