Package java.text

Examples of java.text.ParsePosition


     * @return the parsed {@link Complex} object.
     * @throws MathParseException if the beginning of the specified string
     * cannot be parsed.
     */
    public Complex parse(String source) throws MathParseException {
        ParsePosition parsePosition = new ParsePosition(0);
        Complex result = parse(source, parsePosition);
        if (parsePosition.getIndex() == 0) {
            throw new MathParseException(source,
                                         parsePosition.getErrorIndex(),
                                         Complex.class);
        }
        return result;
    }
View Full Code Here


     * @exception MathParseException if the beginning of the specified string
     *            cannot be parsed.
     */
    @Override
    public BigFraction parse(final String source) throws MathParseException {
        final ParsePosition parsePosition = new ParsePosition(0);
        final BigFraction result = parse(source, parsePosition);
        if (parsePosition.getIndex() == 0) {
            throw new MathParseException(source, parsePosition.getErrorIndex(), BigFraction.class);
        }
        return result;
    }
View Full Code Here

     * @return the parsed {@link RealVector} object.
     * @throws MathParseException if the beginning of the specified string
     * cannot be parsed.
     */
    public ArrayRealVector parse(String source) {
        final ParsePosition parsePosition = new ParsePosition(0);
        final ArrayRealVector result = parse(source, parsePosition);
        if (parsePosition.getIndex() == 0) {
            throw new MathParseException(source,
                                         parsePosition.getErrorIndex(),
                                         ArrayRealVector.class);
        }
        return result;
    }
View Full Code Here

    }

    /** {@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;
    }
View Full Code Here

     * @return the parsed {@link RealMatrix} object.
     * @throws MathParseException if the beginning of the specified string
     * cannot be parsed.
     */
    public RealMatrix parse(String source) {
        final ParsePosition parsePosition = new ParsePosition(0);
        final RealMatrix result = parse(source, parsePosition);
        if (parsePosition.getIndex() == 0) {
            throw new MathParseException(source,
                                         parsePosition.getErrorIndex(),
                                         Array2DRowRealMatrix.class);
        }
        return result;
    }
View Full Code Here

        // Remove leading and trailing white space
        value = value.trim();

        // Parse and detect errors. If the full string was not used, it is
        // an error.
        ParsePosition parsePosition = new ParsePosition(0);
        Number parsedValue = getFormat(locale).parse(value, parsePosition);
        if (parsePosition.getIndex() != value.length()) {
            throw new ConversionException("Could not convert '" + value
                    + "' to " + getModelType().getName());
        }

        if (parsedValue == null) {
View Full Code Here

        }

        // Remove leading and trailing white space
        value = value.trim();

        ParsePosition parsePosition = new ParsePosition(0);
        Date parsedValue = getFormat(locale).parse(value, parsePosition);
        if (parsePosition.getIndex() != value.length()) {
            throw new ConversionException("Could not convert '" + value
                    + "' to " + getModelType().getName());
        }

        return parsedValue;
View Full Code Here

  /**
   * @generated
   */
  public IParserEditStatus isValidEditString(IAdaptable adapter,
      String editString) {
    ParsePosition pos = new ParsePosition(0);
    Object[] values = getEditProcessor().parse(editString, pos);
    if (values == null) {
      return new ParserEditStatus(
          OntoUML.diagram.part.OntoUMLDiagramEditorPlugin.ID,
          IParserEditStatus.UNEDITABLE,
          NLS
              .bind(
                  OntoUML.diagram.part.Messages.MessageFormatParser_InvalidInputError,
                  new Integer(pos.getErrorIndex())));
    }
    return validateNewValues(values);
  }
View Full Code Here

   * @generated
   */
  public ICommand getParseCommand(IAdaptable adapter, String newString,
      int flags) {
    Object[] values = getEditProcessor().parse(newString,
        new ParsePosition(0));
    return getParseCommand(adapter, values, flags);
  }
View Full Code Here

    }

    /** {@inheritDoc} */
    @Override
    public Vector1D parse(final String source) {
        ParsePosition parsePosition = new ParsePosition(0);
        Vector1D result = parse(source, parsePosition);
        if (parsePosition.getIndex() == 0) {
            throw new MathParseException(source,
                                         parsePosition.getErrorIndex(),
                                         Vector1D.class);
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of java.text.ParsePosition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.