本文整理汇总了Java中org.apache.commons.math3.exception.util.LocalizedFormats.ENDPOINTS_NOT_AN_INTERVAL属性的典型用法代码示例。如果您正苦于以下问题:Java LocalizedFormats.ENDPOINTS_NOT_AN_INTERVAL属性的具体用法?Java LocalizedFormats.ENDPOINTS_NOT_AN_INTERVAL怎么用?Java LocalizedFormats.ENDPOINTS_NOT_AN_INTERVAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.math3.exception.util.LocalizedFormats
的用法示例。
在下文中一共展示了LocalizedFormats.ENDPOINTS_NOT_AN_INTERVAL属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Arc
/** Simple constructor.
* <p>
* If either {@code lower} is equals to {@code upper} or
* the interval exceeds \( 2 \pi \), the arc is considered
* to be the full circle and its initial defining boundaries
* will be forgotten. {@code lower} is not allowed to be
* greater than {@code upper} (an exception is thrown in this case).
* {@code lower} will be canonicalized between 0 and \( 2 \pi \), and
* upper shifted accordingly, so the {@link #getInf()} and {@link #getSup()}
* may not return the value used at instance construction.
* </p>
* @param lower lower angular bound of the arc
* @param upper upper angular bound of the arc
* @param tolerance tolerance below which angles are considered identical
* @exception NumberIsTooLargeException if lower is greater than upper
*/
public Arc(final double lower, final double upper, final double tolerance)
throws NumberIsTooLargeException {
this.tolerance = tolerance;
if (Precision.equals(lower, upper, 0) || (upper - lower) >= MathUtils.TWO_PI) {
// the arc must cover the whole circle
this.lower = 0;
this.upper = MathUtils.TWO_PI;
this.middle = FastMath.PI;
} else if (lower <= upper) {
this.lower = MathUtils.normalizeAngle(lower, FastMath.PI);
this.upper = this.lower + (upper - lower);
this.middle = 0.5 * (this.lower + this.upper);
} else {
throw new NumberIsTooLargeException(LocalizedFormats.ENDPOINTS_NOT_AN_INTERVAL,
lower, upper, true);
}
}
示例2: Interval
/** Simple constructor.
* @param lower lower bound of the interval
* @param upper upper bound of the interval
*/
public Interval(final double lower, final double upper) {
if (upper < lower) {
throw new NumberIsTooSmallException(LocalizedFormats.ENDPOINTS_NOT_AN_INTERVAL,
upper, lower, true);
}
this.lower = lower;
this.upper = upper;
}
示例3: verifyInterval
/**
* Check that the endpoints specify an interval.
*
* @param lower Lower endpoint.
* @param upper Upper endpoint.
* @throws NumberIsTooLargeException if {@code lower >= upper}.
*/
public static void verifyInterval(final double lower,
final double upper)
throws NumberIsTooLargeException {
if (lower >= upper) {
throw new NumberIsTooLargeException(LocalizedFormats.ENDPOINTS_NOT_AN_INTERVAL,
lower, upper, false);
}
}