@Override public DoubleValue load(Double key) throws Exception { return new DoubleValue(key); } });
@Override public DoubleValue load(Double key) throws Exception { return new DoubleValue(key); } });
public static DoubleValue of(float f) { try { return CACHE.get((double) f); } catch (ExecutionException ex) { return new DoubleValue(f); } }
public static DoubleValue of(float f) { try { return CACHE.get((double) f); } catch (ExecutionException ex) { return new DoubleValue(f); } }
public static DoubleValue of(Double d) { try { return CACHE.get(d); } catch (ExecutionException ex) { return new DoubleValue(d); } }
public static DoubleValue of(Double d) { try { return CACHE.get(d); } catch (ExecutionException ex) { return new DoubleValue(d); } }
/** * Create a {@link Value} from a {@link Number}. * @param value * either a {@link Float}, {@link Double}, {@link Integer}, {@link Long}, {@link Short} or {@link Byte}. * @throws IllegalArgumentException * if <tt>value</tt> is not of admissible type * @return */ public static Value createValue(final Number value) throws IllegalArgumentException { if (value instanceof Float) { final float f = value.floatValue(); return f == 0F ? FloatValue.ZERO : Float.isNaN(f) ? FloatValue.NAN : new FloatValue(f); } if (value instanceof Integer || value instanceof Short) return new IntegerValue(value.intValue()); if (value instanceof Long) return new LongValue(value.longValue()); if (value instanceof Double) return new DoubleValue(value.doubleValue()); if (value instanceof Byte) return new ByteArrayValue(new byte[]{value.byteValue()}); throw new IllegalArgumentException("Value type " + value.getClass() + " not supported"); }