Java Code Examples for org.apache.commons.math3.exception.util.LocalizedFormats#OBJECT_TRANSFORMATION
The following examples show how to use
org.apache.commons.math3.exception.util.LocalizedFormats#OBJECT_TRANSFORMATION .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultTransformer.java From astor with GNU General Public License v2.0 | 6 votes |
/** * @param o the object that gets transformed. * @return a double primitive representation of the Object o. * @throws NullArgumentException if Object <code>o</code> is {@code null}. * @throws MathIllegalArgumentException if Object <code>o</code> * cannot successfully be transformed * @see <a href="http://commons.apache.org/collections/api-release/org/apache/commons/collections/Transformer.html">Commons Collections Transformer</a> */ public double transform(Object o) throws NullArgumentException, MathIllegalArgumentException { if (o == null) { throw new NullArgumentException(LocalizedFormats.OBJECT_TRANSFORMATION); } if (o instanceof Number) { return ((Number)o).doubleValue(); } try { return Double.parseDouble(o.toString()); } catch (NumberFormatException e) { throw new MathIllegalArgumentException(LocalizedFormats.CANNOT_TRANSFORM_TO_DOUBLE, o.toString()); } }
Example 2
Source File: DefaultTransformer.java From astor with GNU General Public License v2.0 | 6 votes |
/** * @param o the object that gets transformed. * @return a double primitive representation of the Object o. * @throws NullArgumentException if Object <code>o</code> is {@code null}. * @throws MathIllegalArgumentException if Object <code>o</code> * cannot successfully be transformed * @see <a href="http://commons.apache.org/collections/api-release/org/apache/commons/collections/Transformer.html">Commons Collections Transformer</a> */ public double transform(Object o) throws NullArgumentException, MathIllegalArgumentException { if (o == null) { throw new NullArgumentException(LocalizedFormats.OBJECT_TRANSFORMATION); } if (o instanceof Number) { return ((Number)o).doubleValue(); } try { return Double.valueOf(o.toString()).doubleValue(); } catch (NumberFormatException e) { throw new MathIllegalArgumentException(LocalizedFormats.CANNOT_TRANSFORM_TO_DOUBLE, o.toString()); } }
Example 3
Source File: DefaultTransformer.java From astor with GNU General Public License v2.0 | 6 votes |
/** * @param o the object that gets transformed. * @return a double primitive representation of the Object o. * @throws NullArgumentException if Object <code>o</code> is {@code null}. * @throws MathIllegalArgumentException if Object <code>o</code> * cannot successfully be transformed * @see <a href="http://commons.apache.org/collections/api-release/org/apache/commons/collections/Transformer.html">Commons Collections Transformer</a> */ public double transform(Object o) throws NullArgumentException, MathIllegalArgumentException { if (o == null) { throw new NullArgumentException(LocalizedFormats.OBJECT_TRANSFORMATION); } if (o instanceof Number) { return ((Number)o).doubleValue(); } try { return Double.valueOf(o.toString()).doubleValue(); } catch (NumberFormatException e) { throw new MathIllegalArgumentException(LocalizedFormats.CANNOT_TRANSFORM_TO_DOUBLE, o.toString()); } }
Example 4
Source File: DefaultTransformer.java From astor with GNU General Public License v2.0 | 6 votes |
/** * @param o the object that gets transformed. * @return a double primitive representation of the Object o. * @throws NullArgumentException if Object <code>o</code> is {@code null}. * @throws MathIllegalArgumentException if Object <code>o</code> * cannot successfully be transformed * @see <a href="http://commons.apache.org/collections/api-release/org/apache/commons/collections/Transformer.html">Commons Collections Transformer</a> */ public double transform(Object o) throws NullArgumentException, MathIllegalArgumentException { if (o == null) { throw new NullArgumentException(LocalizedFormats.OBJECT_TRANSFORMATION); } if (o instanceof Number) { return ((Number)o).doubleValue(); } try { return Double.parseDouble(o.toString()); } catch (NumberFormatException e) { throw new MathIllegalArgumentException(LocalizedFormats.CANNOT_TRANSFORM_TO_DOUBLE, o.toString()); } }
Example 5
Source File: DefaultTransformer.java From astor with GNU General Public License v2.0 | 6 votes |
/** * @param o the object that gets transformed. * @return a double primitive representation of the Object o. * @throws NullArgumentException if Object <code>o</code> is {@code null}. * @throws MathIllegalArgumentException if Object <code>o</code> * cannot successfully be transformed * @see <a href="http://commons.apache.org/collections/api-release/org/apache/commons/collections/Transformer.html">Commons Collections Transformer</a> */ public double transform(Object o) throws NullArgumentException, MathIllegalArgumentException { if (o == null) { throw new NullArgumentException(LocalizedFormats.OBJECT_TRANSFORMATION); } if (o instanceof Number) { return ((Number)o).doubleValue(); } try { return Double.valueOf(o.toString()).doubleValue(); } catch (NumberFormatException e) { throw new MathIllegalArgumentException(LocalizedFormats.CANNOT_TRANSFORM_TO_DOUBLE, o.toString()); } }
Example 6
Source File: DefaultTransformer.java From astor with GNU General Public License v2.0 | 6 votes |
/** * @param o the object that gets transformed. * @return a double primitive representation of the Object o. * @throws NullArgumentException if Object <code>o</code> is {@code null}. * @throws MathIllegalArgumentException if Object <code>o</code> * cannot successfully be transformed * @see <a href="http://commons.apache.org/collections/api-release/org/apache/commons/collections/Transformer.html">Commons Collections Transformer</a> */ public double transform(Object o) throws NullArgumentException, MathIllegalArgumentException { if (o == null) { throw new NullArgumentException(LocalizedFormats.OBJECT_TRANSFORMATION); } if (o instanceof Number) { return ((Number)o).doubleValue(); } try { return Double.valueOf(o.toString()).doubleValue(); } catch (NumberFormatException e) { throw new MathIllegalArgumentException(LocalizedFormats.CANNOT_TRANSFORM_TO_DOUBLE, o.toString()); } }
Example 7
Source File: DefaultTransformer.java From astor with GNU General Public License v2.0 | 6 votes |
/** * @param o the object that gets transformed. * @return a double primitive representation of the Object o. * @throws NullArgumentException if Object <code>o</code> is {@code null}. * @throws MathIllegalArgumentException if Object <code>o</code> * cannot successfully be transformed * @see <a href="http://commons.apache.org/collections/api-release/org/apache/commons/collections/Transformer.html">Commons Collections Transformer</a> */ public double transform(Object o) throws NullArgumentException, MathIllegalArgumentException { if (o == null) { throw new NullArgumentException(LocalizedFormats.OBJECT_TRANSFORMATION); } if (o instanceof Number) { return ((Number)o).doubleValue(); } try { return Double.valueOf(o.toString()).doubleValue(); } catch (NumberFormatException e) { throw new MathIllegalArgumentException(LocalizedFormats.CANNOT_TRANSFORM_TO_DOUBLE, o.toString()); } }
Example 8
Source File: DefaultTransformer.java From astor with GNU General Public License v2.0 | 6 votes |
/** * @param o the object that gets transformed. * @return a double primitive representation of the Object o. * @throws NullArgumentException if Object <code>o</code> is {@code null}. * @throws MathIllegalArgumentException if Object <code>o</code> * cannot successfully be transformed * @see <a href="http://commons.apache.org/collections/api-release/org/apache/commons/collections/Transformer.html">Commons Collections Transformer</a> */ public double transform(Object o) throws NullArgumentException, MathIllegalArgumentException { if (o == null) { throw new NullArgumentException(LocalizedFormats.OBJECT_TRANSFORMATION); } if (o instanceof Number) { return ((Number)o).doubleValue(); } try { return Double.parseDouble(o.toString()); } catch (NumberFormatException e) { throw new MathIllegalArgumentException(LocalizedFormats.CANNOT_TRANSFORM_TO_DOUBLE, o.toString()); } }