Java Code Examples for org.apache.commons.math.MathRuntimeException#createParseException()

The following examples show how to use org.apache.commons.math.MathRuntimeException#createParseException() . 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: FractionFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link Fraction} object.
 * @param source the string to parse
 * @return the parsed {@link Fraction} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
@Override
public Fraction parse(final String source) throws ParseException {
    final ParsePosition parsePosition = new ParsePosition(0);
    final Fraction result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                "unparseable fraction number: \"{0}\"", source);
    }
    return result;
}
 
Example 2
Source File: Vector3DFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link Vector3D} object.
 * @param source the string to parse
 * @return the parsed {@link Vector3D} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
public Vector3D parse(String source) throws ParseException {
    ParsePosition parsePosition = new ParsePosition(0);
    Vector3D result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                "unparseable 3D vector: \"{0}\"", source);
    }
    return result;
}
 
Example 3
Source File: BigFractionFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link BigFraction} object.
 * @param source the string to parse
 * @return the parsed {@link BigFraction} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
@Override
public BigFraction parse(final String source) throws ParseException {
    final ParsePosition parsePosition = new ParsePosition(0);
    final BigFraction result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                "unparseable fraction number: \"{0}\"", source);
    }
    return result;
}
 
Example 4
Source File: BigFractionFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link BigFraction} object.
 * @param source the string to parse
 * @return the parsed {@link BigFraction} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
@Override
public BigFraction parse(final String source) throws ParseException {
    final ParsePosition parsePosition = new ParsePosition(0);
    final BigFraction result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                "unparseable fraction number: \"{0}\"", source);
    }
    return result;
}
 
Example 5
Source File: ComplexFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link Complex} object.
 *
 * @param source the string to parse
 * @return the parsed {@link Complex} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
public Complex parse(String source) throws ParseException {
    ParsePosition parsePosition = new ParsePosition(0);
    Complex result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                "unparseable complex number: \"{0}\"", source);
    }
    return result;
}
 
Example 6
Source File: BigFractionFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link BigFraction} object.
 * @param source the string to parse
 * @return the parsed {@link BigFraction} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
@Override
public BigFraction parse(final String source) throws ParseException {
    final ParsePosition parsePosition = new ParsePosition(0);
    final BigFraction result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                "unparseable fraction number: \"{0}\"", source);
    }
    return result;
}
 
Example 7
Source File: FractionFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link Fraction} object.
 * @param source the string to parse
 * @return the parsed {@link Fraction} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
@Override
public Fraction parse(final String source) throws ParseException {
    final ParsePosition parsePosition = new ParsePosition(0);
    final Fraction result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                "unparseable fraction number: \"{0}\"", source);
    }
    return result;
}
 
Example 8
Source File: BigFractionFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link BigFraction} object.
 * @param source the string to parse
 * @return the parsed {@link BigFraction} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
@Override
public BigFraction parse(final String source) throws ParseException {
    final ParsePosition parsePosition = new ParsePosition(0);
    final BigFraction result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                "unparseable fraction number: \"{0}\"", source);
    }
    return result;
}
 
Example 9
Source File: ComplexFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link Complex} object.
 *
 * @param source the string to parse
 * @return the parsed {@link Complex} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
public Complex parse(String source) throws ParseException {
    ParsePosition parsePosition = new ParsePosition(0);
    Complex result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                "unparseable complex number: \"{0}\"", source);
    }
    return result;
}
 
Example 10
Source File: Vector3DFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link Vector3D} object.
 * @param source the string to parse
 * @return the parsed {@link Vector3D} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
public Vector3D parse(String source) throws ParseException {
    ParsePosition parsePosition = new ParsePosition(0);
    Vector3D result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                "unparseable 3D vector: \"{0}\"", source);
    }
    return result;
}
 
Example 11
Source File: FractionFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link Fraction} object.
 * @param source the string to parse
 * @return the parsed {@link Fraction} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
@Override
public Fraction parse(final String source) throws ParseException {
    final ParsePosition parsePosition = new ParsePosition(0);
    final Fraction result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                LocalizedFormats.UNPARSEABLE_FRACTION_NUMBER, source);
    }
    return result;
}
 
Example 12
Source File: FractionFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link Fraction} object.
 * @param source the string to parse
 * @return the parsed {@link Fraction} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
@Override
public Fraction parse(final String source) throws ParseException {
    final ParsePosition parsePosition = new ParsePosition(0);
    final Fraction result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                "unparseable fraction number: \"{0}\"", source);
    }
    return result;
}
 
Example 13
Source File: BigFractionFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link BigFraction} object.
 * @param source the string to parse
 * @return the parsed {@link BigFraction} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
@Override
public BigFraction parse(final String source) throws ParseException {
    final ParsePosition parsePosition = new ParsePosition(0);
    final BigFraction result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                "unparseable fraction number: \"{0}\"", source);
    }
    return result;
}
 
Example 14
Source File: RealVectorFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link RealVector} object.
 * @param source the string to parse
 * @return the parsed {@link RealVector} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
public ArrayRealVector parse(String source) throws ParseException {
    ParsePosition parsePosition = new ParsePosition(0);
    ArrayRealVector result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                "unparseable real vector: \"{0}\"", source);
    }
    return result;
}
 
Example 15
Source File: FractionFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link Fraction} object.
 * @param source the string to parse
 * @return the parsed {@link Fraction} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
@Override
public Fraction parse(final String source) throws ParseException {
    final ParsePosition parsePosition = new ParsePosition(0);
    final Fraction result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                "unparseable fraction number: \"{0}\"", source);
    }
    return result;
}
 
Example 16
Source File: BigFractionFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link BigFraction} object.
 * @param source the string to parse
 * @return the parsed {@link BigFraction} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
@Override
public BigFraction parse(final String source) throws ParseException {
    final ParsePosition parsePosition = new ParsePosition(0);
    final BigFraction result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                LocalizedFormats.UNPARSEABLE_FRACTION_NUMBER, source);
    }
    return result;
}
 
Example 17
Source File: RealVectorFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link RealVector} object.
 * @param source the string to parse
 * @return the parsed {@link RealVector} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
public ArrayRealVector parse(String source) throws ParseException {
    ParsePosition parsePosition = new ParsePosition(0);
    ArrayRealVector result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                "unparseable real vector: \"{0}\"", source);
    }
    return result;
}
 
Example 18
Source File: Vector3DFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link Vector3D} object.
 * @param source the string to parse
 * @return the parsed {@link Vector3D} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
public Vector3D parse(String source) throws ParseException {
    ParsePosition parsePosition = new ParsePosition(0);
    Vector3D result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                "unparseable 3D vector: \"{0}\"", source);
    }
    return result;
}
 
Example 19
Source File: FractionFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link Fraction} object.
 * @param source the string to parse
 * @return the parsed {@link Fraction} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
@Override
public Fraction parse(final String source) throws ParseException {
    final ParsePosition parsePosition = new ParsePosition(0);
    final Fraction result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                "unparseable fraction number: \"{0}\"", source);
    }
    return result;
}
 
Example 20
Source File: BigFractionFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a string to produce a {@link BigFraction} object.
 * @param source the string to parse
 * @return the parsed {@link BigFraction} object.
 * @exception ParseException if the beginning of the specified string
 *            cannot be parsed.
 */
@Override
public BigFraction parse(final String source) throws ParseException {
    final ParsePosition parsePosition = new ParsePosition(0);
    final BigFraction result = parse(source, parsePosition);
    if (parsePosition.getIndex() == 0) {
        throw MathRuntimeException.createParseException(
                parsePosition.getErrorIndex(),
                "unparseable fraction number: \"{0}\"", source);
    }
    return result;
}