/** * Read property as <code>Double</code>. * * @param propertyName name of property. * @return property as <code>Double</code>. */ public static Double pDouble(String propertyName){ return Convert.toDouble(p(propertyName)); }
/** * Sets attribute value as <code>Double</code>. * If there is a {@link Converter} registered for the attribute that converts from Class <code>S</code> to Class * <code>java.lang.Double</code>, given the value is an instance of <code>S</code>, then it will be used, * otherwise performs a conversion using {@link Convert#toDouble(Object)}. * * @param attributeName name of attribute. * @param value value to convert. * @return reference to this model. */ public <T extends Model> T setDouble(String attributeName, Object value) { Converter<Object, Double> converter = modelRegistryLocal.converterForValue(attributeName, value, Double.class); return setRaw(attributeName, converter != null ? converter.convert(value) : Convert.toDouble(value)); }
/** * Gets attribute value as <code>Double</code>. * If there is a {@link Converter} registered for the attribute that converts from Class <code>S</code> to Class * <code>java.lang.Double</code>, given the attribute value is an instance of <code>S</code>, then it will be used, * otherwise performs a conversion using {@link Convert#toDouble(Object)}. * * @param attributeName name of attribute to convert * @return value converted to <code>Double</code> */ public Double getDouble(String attributeName) { Object value = getRaw(attributeName); Converter<Object, Double> converter = modelRegistryLocal.converterForValue(attributeName, value, Double.class); return converter != null ? converter.convert(value) : Convert.toDouble(value); }
/** * double value assigned by controller. * * @param name name of a value assigned by controller. * @return a single value assigned by controller. */ protected double valDouble(String name){ assert name != null; return Convert.toDouble(val(name)); }
/** * Convenience method, returns object from session, equivalent of: * <pre> * <code> * Double val = (Double)session().get(name) * </code> * </pre> * * @param name name of object * @return value */ protected Double sessionDouble(String name){ return Convert.toDouble(session(name)); }
/** * Convenience method, returns object from session, equivalent of: * <pre> * <code> * Double val = (Double)session().get(name) * </code> * </pre> * * @param name name of object * @return value */ protected Double sessionDouble(String name){ return Convert.toDouble(session().get(name)); }
cosineVector = results.get(key).stream().map(a -> Convert.toDouble(Math.round(100000 * (Double) a.get("similarity")))).collect(Collectors.toList()); LinkedHashMap<String, Object> row = new LinkedHashMap<>(); row.put("class", key);
/** * Gets attribute value as <code>Double</code>. * If there is a {@link Converter} registered for the attribute that converts from Class <code>S</code> to Class * <code>java.lang.Double</code>, given the attribute value is an instance of <code>S</code>, then it will be used, * otherwise performs a conversion using {@link Convert#toDouble(Object)}. * * @param attributeName name of attribute to convert * @return value converted to <code>Double</code> */ public Double getDouble(String attributeName) { Object value = getRaw(attributeName); Converter<Object, Double> converter = modelRegistryLocal().converterForValue(attributeName, value, Double.class); return converter != null ? converter.convert(value) : Convert.toDouble(value); }
/** * Gets attribute value as <code>Double</code>. * If there is a {@link Converter} registered for the attribute that converts from Class <code>S</code> to Class * <code>java.lang.Double</code>, given the attribute value is an instance of <code>S</code>, then it will be used, * otherwise performs a conversion using {@link Convert#toDouble(Object)}. * * @param attributeName name of attribute to convert * @return value converted to <code>Double</code> */ public Double getDouble(String attributeName) { Object value = getRaw(attributeName); Converter<Object, Double> converter = modelRegistryLocal().converterForValue(attributeName, value, Double.class); return converter != null ? converter.convert(value) : Convert.toDouble(value); }
/** * Sets attribute value as <code>Double</code>. * If there is a {@link Converter} registered for the attribute that converts from Class <code>S</code> to Class * <code>java.lang.Double</code>, given the value is an instance of <code>S</code>, then it will be used, * otherwise performs a conversion using {@link Convert#toDouble(Object)}. * * @param attributeName name of attribute. * @param value value to convert. * @return reference to this model. */ public <T extends Model> T setDouble(String attributeName, Object value) { Converter<Object, Double> converter = modelRegistryLocal().converterForValue(attributeName, value, Double.class); return setRaw(attributeName, converter != null ? converter.convert(value) : Convert.toDouble(value)); }
/** * Sets attribute value as <code>Double</code>. * If there is a {@link Converter} registered for the attribute that converts from Class <code>S</code> to Class * <code>java.lang.Double</code>, given the value is an instance of <code>S</code>, then it will be used, * otherwise performs a conversion using {@link Convert#toDouble(Object)}. * * @param attributeName name of attribute. * @param value value to convert. * @return reference to this model. */ public <T extends Model> T setDouble(String attributeName, Object value) { Converter<Object, Double> converter = modelRegistryLocal().converterForValue(attributeName, value, Double.class); return setRaw(attributeName, converter != null ? converter.convert(value) : Convert.toDouble(value)); }