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