Code example for ParsePosition

Methods: getErrorIndex, getIndex

0
    } 
 
    /** {@inheritDoc} */ 
    @Override 
    public Vector1D parse(final String source) throws MathParseException {
        ParsePosition parsePosition = new ParsePosition(0);
        Vector1D result = parse(source, parsePosition);
        if (parsePosition.getIndex() == 0) {
            throw new MathParseException(source,
                                         parsePosition.getErrorIndex(),
                                         Vector1D.class); 
        } 
        return result;
    } 
 
    /** {@inheritDoc} */ 
    @Override 
    public Vector1D parse(final String source, final ParsePosition pos) {
        final double[] coordinates = parseCoordinates(1, source, pos);
        if (coordinates == null) {
            return null; 
        } 
        return new Vector1D(coordinates[0]);
    }