Java Code Examples for org.apache.commons.math3.exception.util.LocalizedFormats#ENDPOINTS_NOT_AN_INTERVAL

The following examples show how to use org.apache.commons.math3.exception.util.LocalizedFormats#ENDPOINTS_NOT_AN_INTERVAL . 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: Arc.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** 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);
    }
}
 
Example 2
Source File: Arc.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** 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);
    }
}
 
Example 3
Source File: UnivariateSolverUtils.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 4
Source File: UnivariateSolverUtils.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 5
Source File: UnivariateSolverUtils.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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) {
    if (lower >= upper) {
        throw new NumberIsTooLargeException(LocalizedFormats.ENDPOINTS_NOT_AN_INTERVAL,
                                            lower, upper, false);
    }
}
 
Example 6
Source File: UnivariateSolverUtils.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 7
Source File: UnivariateSolverUtils.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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) {
    if (lower >= upper) {
        throw new NumberIsTooLargeException(LocalizedFormats.ENDPOINTS_NOT_AN_INTERVAL,
                                            lower, upper, false);
    }
}
 
Example 8
Source File: UnivariateSolverUtils.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 9
Source File: UnivariateSolverUtils.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 10
Source File: UnivariateSolverUtils.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
    }
}