net.sf.json.JSONObject.optDouble()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中net.sf.json.JSONObject.optDouble()方法的一些代码示例,展示了JSONObject.optDouble()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.optDouble()方法的具体详情如下:
包路径:net.sf.json.JSONObject
类名称:JSONObject
方法名:optDouble

JSONObject.optDouble介绍

暂无

代码示例

代码示例来源:origin: gooddata/GoodData-CL

public double optDouble(String key, double defaultValue) {
  return jsonObject.optDouble(key, defaultValue);
}

代码示例来源:origin: gooddata/GoodData-CL

public double optDouble(String key) {
  return jsonObject.optDouble(key);
}

代码示例来源:origin: Aresyi/smart-api

@Override
  public int compare(Object o1, Object o2) {
    if(o1 instanceof JSONObject && o2 instanceof JSONObject){
      double v = ((JSONObject) o2).optDouble("version") - ((JSONObject) o1).optDouble("version");
      return (int)Math.floor(v*10000);
    }
    return 0;
  }
});

代码示例来源:origin: jenkinsci/cobertura-plugin

private static Float getFloat(JSONObject object, String key) {
  Float floatValue = new Float(object.optDouble(key));
  
  return floatValue.isNaN() ? null : floatValue;
}

代码示例来源:origin: mbreese/couchdb4j

public double optDouble(String arg0) {
  return getJSONObject().optDouble(arg0);
}
public int optInt(String arg0, int arg1) {

代码示例来源:origin: mbreese/couchdb4j

public double optDouble(String arg0, double arg1) {
  return getJSONObject().optDouble(arg0, arg1);
}
public double optDouble(String arg0) {

代码示例来源:origin: itesla/ipst

private static void processTreeNode(JSONObject node, JSONArray inputs, double purityThreshold, SecondLevelNode currentCondition, List<SecondLevelNode> trueConditions, JSONObject stats, int trueIdx) {
  if ("thresholdTest".equals(node.optString("type"))) {
    // conditional node
    int inputIdx = node.optInt("inputIndex");
    HistoDbAttributeId attrId = HistoDbAttributeIdParser.parse(inputs.opt(inputIdx).toString());
    double threshold = node.optDouble("threshold");
    ComparisonOperator trueCondition = new ComparisonOperator(new Attribute(attrId), new Litteral(threshold), ComparisonOperator.Type.LESS);
    ComparisonOperator falseCondition = new ComparisonOperator(new Attribute(attrId), new Litteral(threshold), ComparisonOperator.Type.GREATER_EQUAL);
    processTreeNode(node.optJSONObject("trueChild"), inputs, purityThreshold,
            currentCondition == null ? trueCondition : new AndOperator(currentCondition.clone(), trueCondition),
            trueConditions, stats, trueIdx);
    processTreeNode(node.optJSONObject("falseChild"), inputs, purityThreshold,
            currentCondition == null ? falseCondition : new AndOperator(currentCondition.clone(), falseCondition),
            trueConditions, stats, trueIdx);
  } else {
    if (currentCondition != null && isTrueCondition(stats, node, purityThreshold, trueIdx)) {
      trueConditions.add(currentCondition);
    }
  }
}

相关文章

微信公众号

最新文章

更多