package com.tofly.ghrq_route.module.uploadFile.domain;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;

/**
 * Created by Amu on 2017/9/13.
 */
public class UploadFileTypeSort implements Comparator<UploadFileBean> {
    String[] repairTypes;

    public UploadFileTypeSort(String[] repairTypes) {
        this.repairTypes = repairTypes;
    }

    @Override
    public int compare(UploadFileBean arg0, UploadFileBean arg1) {
        List<String> fileTypeList = Arrays.asList(repairTypes);
        int index0 = fileTypeList.indexOf(arg0.getFilenote());
        int index1 = fileTypeList.indexOf(arg1.getFilenote());
        if (index0 > index1) {
            return 1;
        } else if (index0 == index1) {
            return 0;
        } else {
            return -1;
        }
    }
}
