Search in sources :

Example 11 with InPara

use of com.tencent.wstt.gt.InPara in project GT by Tencent.

the class DefaultInParaManager method register.

@Override
public void register(String paraName, String alias, String defaultValue, String... optionalValues) {
    if (alias.length() > 4) {
        alias = alias.substring(0, 3) + ".";
    }
    InPara para = new InPara();
    para.setKey(paraName);
    para.setAlias(alias);
    para.setClient(client.getKey());
    List<String> vals = new ArrayList<String>();
    vals.add(defaultValue);
    for (String ov : optionalValues) {
        vals.add(ov);
    }
    para.setValues(vals);
    para.setDisplayProperty(InPara.DISPLAY_NORMAL);
    synchronized (inParaMap) {
        if (checkInParaAvilable(para)) {
            inParaMap.put(paraName, para);
            sortedInParas.put(sortedInParas.size(), para);
            sortedInParaList.add(para);
        }
    }
}
Also used : InPara(com.tencent.wstt.gt.InPara) ArrayList(java.util.ArrayList)

Example 12 with InPara

use of com.tencent.wstt.gt.InPara in project GT by Tencent.

the class DefaultInParaManager method getInPara.

@Override
public byte getInPara(String paraName, byte origVal) {
    InPara iv = inParaMap.get(paraName);
    byte value = origVal;
    if (null != iv) {
        List<String> vals = iv.getValues();
        String val = vals.get(0);
        if (matchInParaType(val, "byte")) {
            value = Byte.parseByte(val);
        }
    }
    return value;
}
Also used : InPara(com.tencent.wstt.gt.InPara)

Example 13 with InPara

use of com.tencent.wstt.gt.InPara in project GT by Tencent.

the class IpUIManager method addItemToAC.

public static void addItemToAC(InPara ip) {
    if (list_ip.contains(ip) || ip.getDisplayProperty() != AidlEntry.DISPLAY_AC) {
        return;
    }
    // AC
    int pos_AC = getInListDividePosition();
    /*
		 * list_ip为空,压根就没有线,这里先把三条基本线加上逻辑上比较好判断
		 * 其实加一条普通关注分界线为锚点即可
		 */
    if (pos_AC == 0) {
        // 悬浮框分界线
        InPara iv_ac = new InPara();
        iv_ac.setKey(ParamConst.PROMPT_INIT_TITLE);
        iv_ac.setDisplayProperty(InPara.DISPLAY_TITLE);
        list_ip.add(iv_ac);
        // 加普通关注分界线
        InPara iv_normalDivid = new InPara();
        iv_normalDivid.setKey(ParamConst.DIVID_TITLE);
        iv_normalDivid.setDisplayProperty(InPara.DISPLAY_TITLE);
        list_ip.add(iv_normalDivid);
        // 加disable入参分界线
        InPara iv_disableDivid = new InPara();
        iv_disableDivid.setKey(ParamConst.PROMPT_DISABLE_TITLE);
        iv_disableDivid.setDisplayProperty(InPara.DISPLAY_TITLE);
        IpUIManager.list_ip.add(iv_disableDivid);
        pos_AC = 1;
    }
    if (pos_AC < 4) {
        list_ip.add(pos_AC, ip);
    } else {
        ip.setDisplayProperty(AidlEntry.DISPLAY_NORMAL);
    }
}
Also used : InPara(com.tencent.wstt.gt.InPara)

Example 14 with InPara

use of com.tencent.wstt.gt.InPara in project GT by Tencent.

the class InParaManagerInternal method register.

public void register(String ParaName, String alias, String defaultValue, String... optionalValues) {
    if (null == ParaName || null == alias || null == defaultValue || null == optionalValues) {
        return;
    }
    if (alias.length() > 4) {
        alias = alias.substring(0, 3) + ".";
    }
    InPara Para = new InPara();
    Para.setKey(ParaName);
    Para.setAlias(alias);
    Para.setDisplayProperty(InPara.DISPLAY_NORMAL);
    List<String> vals = new ArrayList<String>();
    vals.add(defaultValue);
    for (int i = 0; i < optionalValues.length; i++) {
        vals.add(optionalValues[i]);
    }
    //在最后加入disable,选择disable,则入参使用被测工程代码中的原值
    if (!vals.contains("<null>")) {
        vals.add("<null>");
    }
    Para.setValues(vals);
    Para.setRegistering(true);
    temp.add(Para);
}
Also used : InPara(com.tencent.wstt.gt.InPara) ArrayList(java.util.ArrayList)

Example 15 with InPara

use of com.tencent.wstt.gt.InPara in project GT by Tencent.

the class ConnectedState method getInPara.

@Override
public double getInPara(String paraName, double origVal, boolean isGlobal) {
    // connected态的这个方法需要直接调aidl接口
    InPara iv = getInPara(paraName, isGlobal);
    double result = origVal;
    if (null != iv) {
        if (InPara.DISPLAY_DISABLE == iv.getDisplayProperty()) {
            result = origVal;
        } else {
            List<String> vals = iv.getValues();
            String val = vals.get(0);
            if (val.equals("<null>")) {
                result = 0;
            } else if (matchInParaType(val, "double")) {
                result = Double.parseDouble(vals.get(0));
            }
        }
    }
    return result;
}
Also used : InPara(com.tencent.wstt.gt.InPara)

Aggregations

InPara (com.tencent.wstt.gt.InPara)30 ArrayList (java.util.ArrayList)4 ParamConst (com.tencent.wstt.gt.manager.ParamConst)2 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 OutPara (com.tencent.wstt.gt.OutPara)1