private boolean defaultValueEquals(JsonNode thatDefaultValue) { if (defaultValue == null) return thatDefaultValue == null; if (Double.isNaN(defaultValue.getDoubleValue())) return Double.isNaN(thatDefaultValue.getDoubleValue()); return defaultValue.equals(thatDefaultValue); }
@Override public float getFloatValue() throws IOException, JsonParseException { return (float) currentNumericNode().getDoubleValue(); }
@Override public double getDoubleValue() throws IOException, JsonParseException { return currentNumericNode().getDoubleValue(); }
if (!n.isNumber()) throw new AvroTypeException("Non-numeric default value for float: "+n); e.writeFloat((float) n.getDoubleValue()); break; case DOUBLE: if (!n.isNumber()) throw new AvroTypeException("Non-numeric default value for double: "+n); e.writeDouble(n.getDoubleValue()); break; case BOOLEAN:
@Override public float getFloatValue() throws IOException, JsonParseException { return (float) currentNumericNode().getDoubleValue(); }
@Override public double getDoubleValue() throws IOException, JsonParseException { return currentNumericNode().getDoubleValue(); }
case VALUE_NUMBER_FLOAT: out.writeIndex(JsonType.DOUBLE.ordinal()); out.writeDouble(node.getDoubleValue()); break; case VALUE_STRING:
return jsonNode.getIntValue(); case FLOAT: return new Float(jsonNode.getDoubleValue()); case DOUBLE: return jsonNode.getDoubleValue(); case BOOLEAN: return jsonNode.getBooleanValue();
public double getDoubleValue() { return delegate.getDoubleValue(); }
private boolean defaultValueEquals(JsonNode thatDefaultValue) { if (defaultValue == null) return thatDefaultValue == null; if (Double.isNaN(defaultValue.getDoubleValue())) return Double.isNaN(thatDefaultValue.getDoubleValue()); return defaultValue.equals(thatDefaultValue); }
@Override public double getDoubleValue() throws IOException, JsonParseException { return currentNumericNode().getDoubleValue(); }
@Override public float getFloatValue() throws IOException, JsonParseException { return (float) currentNumericNode().getDoubleValue(); }
@Override public float getFloatValue() throws IOException, JsonParseException { return (float) currentNumericNode().getDoubleValue(); }
/** @return a point */ private Point createPoint(final JsonNode coordinates) throws IOException { final Point ret; if(coordinates.isArray()) { ret = new Point(coordinates.get(0).getDoubleValue(), coordinates.get(1).getDoubleValue()); } else { ret = null; } return ret; }
private boolean hasReasonableMatchScore(JsonNode result) { double score = 0.0; if (result.has("score")) { if (result.get("score").isDouble()) { score = result.get("score").getDoubleValue(); } } return score > minMatchScore; }
public static Double getDouble(JsonNode node, String prop, Double defaultValue) throws JsonFormatException { if (node.get(prop) == null) { return defaultValue; } if (!node.get(prop).isLong() && !node.get(prop).isDouble()) { throw new JsonFormatException("Not a double property: " + prop); } return node.get(prop).getDoubleValue(); }
public static Double getDouble(JsonNode node, String prop, Double defaultValue) throws JsonFormatException { if (node.get(prop) == null) { return defaultValue; } if (!node.get(prop).isLong() && !node.get(prop).isDouble()) { throw new JsonFormatException("Not a double property: " + prop); } return node.get(prop).getDoubleValue(); }
public static Double getDouble(JsonNode node, String prop, Double defaultValue) throws JsonFormatException { if (node.get(prop) == null || node.get(prop).isNull()) { return defaultValue; } if (!node.get(prop).isLong() && !node.get(prop).isDouble()) { throw new JsonFormatException("Not a double property: " + prop); } return node.get(prop).getDoubleValue(); }
private Double getDouble(final String path, final JsonNode node) { if (representsNull(node)) { return null; } checkValue(path, node, "a double"); if (!node.isDouble()) { throw new IllegalArgumentException(formatExMsg(path, "is not a double")); } return node.getDoubleValue(); }
private Double getDouble(final String path, final JsonNode node) { if (representsNull(node)) { return null; } checkValue(path, node, "a double"); if (!node.isDouble()) { throw new IllegalArgumentException(formatExMsg(path, "is not a double")); } return node.getDoubleValue(); }