package jtznyj.engineer.service.dataDiagnosticService.data;

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

/**
 * 数据诊断参数集合
 */
public class DataDiagnosticParameters {
    /**
     * 钻机状态
     */
    public int _drillState = 111;

    /**
     * 百分比
     */
    public double percent = 0.0;

    /**
     * 是否启用
     */
    public boolean _isEnable = true;

    /**
     * 诊断参数
     */
    public ArrayList<DataDiagnosticParameter> parameters;

    public DataDiagnosticParameters(){
        this.parameters = new ArrayList<>();
    }

    public static Comparator<DataDiagnosticParameter> GroupNumberComparator = new Comparator<DataDiagnosticParameter>() {
        public int compare(DataDiagnosticParameter mcp0, DataDiagnosticParameter mcp1) {
            int result;
            if (mcp0._fzNum > mcp1._fzNum) {
                result = 1;
            } else if (mcp0._fzNum == mcp1._fzNum) {
                result = 0;
            } else {
                result = -1;
            }
            return result;
        }
    };

    /**
     * 根据分组编号升序排序
     */
    public void sortByGroupNum(){
        this.parameters.sort(GroupNumberComparator);
    }
}
