本文整理汇总了Java中org.apache.commons.math.MathRuntimeException.createParseException方法的典型用法代码示例。如果您正苦于以下问题:Java MathRuntimeException.createParseException方法的具体用法?Java MathRuntimeException.createParseException怎么用?Java MathRuntimeException.createParseException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math.MathRuntimeException
的用法示例。
在下文中一共展示了MathRuntimeException.createParseException方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* 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;
}
示例2: parse
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* 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;
}
示例3: parse
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* 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;
}
示例4: parse
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* 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;
}
示例5: parse
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* 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;
}
示例6: parse
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* 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;
}
示例7: parse
import org.apache.commons.math.MathRuntimeException; //导入方法依赖的package包/类
/**
* 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;
}