package com.njcn.harmonic.utils;

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;
    }

}
