public static double unboxed(Double v) { return v == null ? 0 : v.doubleValue(); }
public static double unboxed(Double v) { return v == null ? 0 : v.doubleValue(); }
@Override public boolean apply(Double input) { return input.doubleValue() > 0.0; } });
@Override public void serialize(Object value, JsonGenerator gen, SerializerProvider provider) throws IOException { gen.writeNumber(((Double) value).doubleValue()); }
@Override public void writeTag(Object data, MBOut out) { double d = ((Double) data).doubleValue(); { byte[] bytes = Double.toString(d).getBytes(); out.writeArray(bytes, 0, bytes.length); } }
/** * Converts value to <code>double</code>. Returns default value * when conversion result is <code>null</code>. */ public double toDoubleValue(Object value, double defaultValue) { Double result = (Double) typeConverters[9].convert(value); if (result == null) { return defaultValue; } return result.doubleValue(); }
/** * Converts type using type converter manager. */ protected double convertType(Object value) { return typeConverterManagerBean.convertType(value, double.class).doubleValue(); }
public double getDoubleProperty(String name) throws JMSException { Object value = this.properties.get(name); return (value instanceof Double) ? ((Double) value).doubleValue() : 0; }
/** * Alternate factory method that will handle wrapper value, which may * be null. * Due to possibility of null, returning type is not guaranteed to be * {@link NumericNode}, but just {@link ValueNode}. */ @Override public ValueNode numberNode(Double value) { return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue()); }
/** * Alternate factory method that will handle wrapper value, which may * be null. * Due to possibility of null, returning type is not guaranteed to be * {@link NumericNode}, but just {@link ValueNode}. */ @Override public ValueNode numberNode(Double value) { return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue()); }
public double getEstimate() { if (cachedEstimate == null) { cachedEstimate = getSketch().getEstimate(); } return cachedEstimate.doubleValue(); }
/** * Alternative method that we need to avoid bumping into NPE issues * with auto-unboxing. * * @return This array node, to allow chaining */ public ArrayNode add(Double value) { if (value == null) { return addNull(); } return _add(numberNode(value.doubleValue())); }
/** * Alternative method that we need to avoid bumping into NPE issues * with auto-unboxing. * * @return This array node, to allow chaining */ public ArrayNode insert(int index, Double value) { if (value == null) { return insertNull(index); } return _insert(index, numberNode(value.doubleValue())); }
/** * Alternative method that we need to avoid bumping into NPE issues * with auto-unboxing. * * @return This node (to allow chaining) */ public ObjectNode put(String fieldName, Double v) { return _put(fieldName, (v == null) ? nullNode() : numberNode(v.doubleValue())); }
/** * Alternative method that we need to avoid bumping into NPE issues * with auto-unboxing. * * @return This node (to allow chaining) */ public ObjectNode put(String fieldName, Double v) { return _put(fieldName, (v == null) ? nullNode() : numberNode(v.doubleValue())); }
/** * Alternative method that we need to avoid bumping into NPE issues * with auto-unboxing. * * @return This array node, to allow chaining */ public ArrayNode insert(int index, Double value) { if (value == null) { return insertNull(index); } return _insert(index, numberNode(value.doubleValue())); }
/** * Alternative method that we need to avoid bumping into NPE issues * with auto-unboxing. * * @return This array node, to allow chaining */ public ArrayNode add(Double value) { if (value == null) { return addNull(); } return _add(numberNode(value.doubleValue())); }
@Test public void testCombine() { Assert.assertEquals(3.4d, ((Double) doubleMaxAggFactory.combine(1.2, 3.4)).doubleValue(), 0.0001); }
@Test public void testCombine() { Assert.assertEquals(1.2d, ((Double) doubleMinAggFactory.combine(1.2, 3.4)).doubleValue(), 0.0001); }
public void testGetDefaultValue() { assertEquals(false, Defaults.defaultValue(boolean.class).booleanValue()); assertEquals('\0', Defaults.defaultValue(char.class).charValue()); assertEquals(0, Defaults.defaultValue(byte.class).byteValue()); assertEquals(0, Defaults.defaultValue(short.class).shortValue()); assertEquals(0, Defaults.defaultValue(int.class).intValue()); assertEquals(0, Defaults.defaultValue(long.class).longValue()); assertEquals(0.0f, Defaults.defaultValue(float.class).floatValue()); assertEquals(0.0d, Defaults.defaultValue(double.class).doubleValue()); assertNull(Defaults.defaultValue(void.class)); assertNull(Defaults.defaultValue(String.class)); } }