/** * Attempts to transform the Object against the map of * NumberTransformers. Otherwise it returns Double.NaN. * * @param o the Object to be transformed. * @return the double value of the Object. * @throws MathException if the Object can not be transformed into a Double. * @see org.apache.commons.math.util.NumberTransformer#transform(java.lang.Object) */ public double transform(Object o) throws MathException { double value = Double.NaN; if (o instanceof Number || o instanceof String) { value = defaultTransformer.transform(o); } else { NumberTransformer trans = getTransformer(o.getClass()); if (trans != null) { value = trans.transform(o); } } return value; }
/** * Attempts to transform the Object against the map of * NumberTransformers. Otherwise it returns Double.NaN. * * @param o the Object to be transformed. * @return the double value of the Object. * @throws MathException if the Object can not be transformed into a Double. * @see org.apache.commons.math.util.NumberTransformer#transform(java.lang.Object) */ public double transform(Object o) throws MathException { double value = Double.NaN; if (o instanceof Number || o instanceof String) { value = defaultTransformer.transform(o); } else { NumberTransformer trans = getTransformer(o.getClass()); if (trans != null) { value = trans.transform(o); } } return value; }
/** * Attempts to transform the Object against the map of * NumberTransformers. Otherwise it returns Double.NaN. * * @param o the Object to be transformed. * @return the double value of the Object. * @throws MathException if the Object can not be transformed into a Double. * @see org.apache.commons.math.util.NumberTransformer#transform(java.lang.Object) */ public double transform(Object o) throws MathException { double value = Double.NaN; if (o instanceof Number || o instanceof String) { value = defaultTransformer.transform(o); } else { NumberTransformer trans = getTransformer(o.getClass()); if (trans != null) { value = trans.transform(o); } } return value; }