package com.njcn.csharmonic.utils;

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

public class DataChangeUtil {

    /**
     * 用来将二次值转成一次值
     */
    public static double secondaryToPrimary(String formula, Double data,Double pt, Double ct) {
        switch (formula) {

            case "*PT":
                data = data * pt;
                break;
            case "*CT":
                data = data * ct;
                break;
            case "*PT*CT":
                data = data * pt * ct;
                break;
            default:
                break;
        }
        return data;
    }

    /**
     * 用来将一次值转成二次值
     */
    public static double primaryToSecondary(String formula, Double data,Double pt, Double ct) {
        switch (formula) {
            case "*PT":
                data = data / pt;
                break;
            case "*CT":
                data = data / ct;
                break;
            case "*PT*CT":
                data = data / pt / ct;
                break;
            default:
                break;
        }
        return data;
    }

    public static List<String> getTag(List<String> target) {
        List<String> tag = new ArrayList<>();
        target.forEach(temp -> {
            switch (temp) {
                case "暂降":
                    tag.add("Evt_Sys_DipStr");
                    break;
                case "中断":
                    tag.add("Evt_Sys_IntrStr");
                    break;
                case "暂升":
                    tag.add("Evt_Sys_SwlStr");
                    break;
                case "瞬态":
                    tag.add("Evt_Sys_QitrV");
                    tag.add("Evt_Sys_QitrA");
                    tag.add("Transient");
                    break;
                case "振荡":
                    tag.add("Evt_Sys_PoscLowStr");
                    tag.add("Evt_Sys_PoscSyncStr");
                    tag.add("Evt_Sys_PoscWideStr");
                    break;
                default:
                    break;
            }
        });
        return tag;
    }

}
