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

The following examples show how to use org.apache.commons.math3.exception.util.LocalizedFormats#OUT_OF_RANGE_LEFT . 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: StableRandomGenerator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a new generator.
 *
 * @param generator underlying random generator to use
 * @param alpha Stability parameter. Must be in range (0, 2]
 * @param beta Skewness parameter. Must be in range [-1, 1]
 */
public StableRandomGenerator(final RandomGenerator generator, double alpha,
        double beta) {
    if (generator == null) {
        throw new NullArgumentException();
    }

    if (!(alpha > 0d && alpha <= 2d)) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_LEFT,
                alpha, 0, 2);
    }

    if (!(beta >= -1d && beta <= 1d)) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_SIMPLE,
                beta, -1, 1);
    }

    this.generator = generator;
    this.alpha = alpha;
    this.beta = beta;
    if (alpha < 2d && beta != 0d) {
        zeta = beta * FastMath.tan(FastMath.PI * alpha / 2);
    } else {
        zeta = 0d;
    }
}
 
Example 2
Source File: StableRandomGenerator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a new generator.
 *
 * @param generator underlying random generator to use
 * @param alpha Stability parameter. Must be in range (0, 2]
 * @param beta Skewness parameter. Must be in range [-1, 1]
 */
public StableRandomGenerator(final RandomGenerator generator, double alpha,
        double beta) {
    if (generator == null) {
        throw new NullArgumentException();
    }

    if (!(alpha > 0d && alpha <= 2d)) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_LEFT,
                alpha, 0, 2);
    }

    if (!(beta >= -1d && beta <= 1d)) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_SIMPLE,
                beta, -1, 1);
    }

    this.generator = generator;
    this.alpha = alpha;
    this.beta = beta;
    if (alpha < 2d && beta != 0d) {
        zeta = beta * FastMath.tan(FastMath.PI * alpha / 2);
    } else {
        zeta = 0d;
    }
}
 
Example 3
Source File: GeometricDistribution.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a geometric distribution.
 *
 * @param rng Random number generator.
 * @param p Probability of success.
 * @throws OutOfRangeException if {@code p <= 0} or {@code p > 1}.
 */
public GeometricDistribution(RandomGenerator rng, double p) {
    super(rng);

    if (p <= 0 || p > 1) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_LEFT, p, 0, 1);
    }

    probabilityOfSuccess = p;
}
 
Example 4
Source File: StableRandomGenerator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new generator.
 *
 * @param generator underlying random generator to use
 * @param alpha Stability parameter. Must be in range (0, 2]
 * @param beta Skewness parameter. Must be in range [-1, 1]
 * @throws NullArgumentException if generator is null
 * @throws OutOfRangeException if {@code alpha <= 0} or {@code alpha > 2}
 * or {@code beta < -1} or {@code beta > 1}
 */
public StableRandomGenerator(final RandomGenerator generator,
                             final double alpha, final double beta)
    throws NullArgumentException, OutOfRangeException {
    if (generator == null) {
        throw new NullArgumentException();
    }

    if (!(alpha > 0d && alpha <= 2d)) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_LEFT,
                alpha, 0, 2);
    }

    if (!(beta >= -1d && beta <= 1d)) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_SIMPLE,
                beta, -1, 1);
    }

    this.generator = generator;
    this.alpha = alpha;
    this.beta = beta;
    if (alpha < 2d && beta != 0d) {
        zeta = beta * FastMath.tan(FastMath.PI * alpha / 2);
    } else {
        zeta = 0d;
    }
}
 
Example 5
Source File: StableRandomGenerator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new generator.
 *
 * @param generator underlying random generator to use
 * @param alpha Stability parameter. Must be in range (0, 2]
 * @param beta Skewness parameter. Must be in range [-1, 1]
 * @throws NullArgumentException if generator is null
 * @throws OutOfRangeException if {@code alpha <= 0} or {@code alpha > 2} 
 * or {@code beta < -1} or {@code beta > 1} 
 */
public StableRandomGenerator(final RandomGenerator generator,
                             final double alpha, final double beta)
    throws NullArgumentException, OutOfRangeException {
    if (generator == null) {
        throw new NullArgumentException();
    }

    if (!(alpha > 0d && alpha <= 2d)) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_LEFT,
                alpha, 0, 2);
    }

    if (!(beta >= -1d && beta <= 1d)) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_SIMPLE,
                beta, -1, 1);
    }

    this.generator = generator;
    this.alpha = alpha;
    this.beta = beta;
    if (alpha < 2d && beta != 0d) {
        zeta = beta * FastMath.tan(FastMath.PI * alpha / 2);
    } else {
        zeta = 0d;
    }
}
 
Example 6
Source File: GeometricDistribution.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a geometric distribution.
 *
 * @param rng Random number generator.
 * @param p Probability of success.
 * @throws OutOfRangeException if {@code p <= 0} or {@code p > 1}.
 */
public GeometricDistribution(RandomGenerator rng, double p) {
    super(rng);

    if (p <= 0 || p > 1) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_LEFT, p, 0, 1);
    }

    probabilityOfSuccess = p;
}
 
Example 7
Source File: StableRandomGenerator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new generator.
 *
 * @param generator underlying random generator to use
 * @param alpha Stability parameter. Must be in range (0, 2]
 * @param beta Skewness parameter. Must be in range [-1, 1]
 * @throws NullArgumentException if generator is null
 * @throws OutOfRangeException if {@code alpha <= 0} or {@code alpha > 2}
 * or {@code beta < -1} or {@code beta > 1}
 */
public StableRandomGenerator(final RandomGenerator generator,
                             final double alpha, final double beta)
    throws NullArgumentException, OutOfRangeException {
    if (generator == null) {
        throw new NullArgumentException();
    }

    if (!(alpha > 0d && alpha <= 2d)) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_LEFT,
                alpha, 0, 2);
    }

    if (!(beta >= -1d && beta <= 1d)) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_SIMPLE,
                beta, -1, 1);
    }

    this.generator = generator;
    this.alpha = alpha;
    this.beta = beta;
    if (alpha < 2d && beta != 0d) {
        zeta = beta * FastMath.tan(FastMath.PI * alpha / 2);
    } else {
        zeta = 0d;
    }
}
 
Example 8
Source File: StableRandomGenerator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new generator.
 *
 * @param generator underlying random generator to use
 * @param alpha Stability parameter. Must be in range (0, 2]
 * @param beta Skewness parameter. Must be in range [-1, 1]
 * @throws NullArgumentException if generator is null
 * @throws OutOfRangeException if {@code alpha <= 0} or {@code alpha > 2}
 * or {@code beta < -1} or {@code beta > 1}
 */
public StableRandomGenerator(final RandomGenerator generator,
                             final double alpha, final double beta)
    throws NullArgumentException, OutOfRangeException {
    if (generator == null) {
        throw new NullArgumentException();
    }

    if (!(alpha > 0d && alpha <= 2d)) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_LEFT,
                alpha, 0, 2);
    }

    if (!(beta >= -1d && beta <= 1d)) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_SIMPLE,
                beta, -1, 1);
    }

    this.generator = generator;
    this.alpha = alpha;
    this.beta = beta;
    if (alpha < 2d && beta != 0d) {
        zeta = beta * FastMath.tan(FastMath.PI * alpha / 2);
    } else {
        zeta = 0d;
    }
}
 
Example 9
Source File: GeometricDistribution.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a geometric distribution.
 *
 * @param rng Random number generator.
 * @param p Probability of success.
 * @throws OutOfRangeException if {@code p <= 0} or {@code p > 1}.
 */
public GeometricDistribution(RandomGenerator rng, double p) {
    super(rng);

    if (p <= 0 || p > 1) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_LEFT, p, 0, 1);
    }

    probabilityOfSuccess = p;
}
 
Example 10
Source File: StableRandomGenerator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new generator.
 *
 * @param generator underlying random generator to use
 * @param alpha Stability parameter. Must be in range (0, 2]
 * @param beta Skewness parameter. Must be in range [-1, 1]
 * @throws NullArgumentException if generator is null
 * @throws OutOfRangeException if {@code alpha <= 0} or {@code alpha > 2}
 * or {@code beta < -1} or {@code beta > 1}
 */
public StableRandomGenerator(final RandomGenerator generator,
                             final double alpha, final double beta)
    throws NullArgumentException, OutOfRangeException {
    if (generator == null) {
        throw new NullArgumentException();
    }

    if (!(alpha > 0d && alpha <= 2d)) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_LEFT,
                alpha, 0, 2);
    }

    if (!(beta >= -1d && beta <= 1d)) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_SIMPLE,
                beta, -1, 1);
    }

    this.generator = generator;
    this.alpha = alpha;
    this.beta = beta;
    if (alpha < 2d && beta != 0d) {
        zeta = beta * FastMath.tan(FastMath.PI * alpha / 2);
    } else {
        zeta = 0d;
    }
}
 
Example 11
Source File: GeometricDistribution.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a geometric distribution.
 *
 * @param rng Random number generator.
 * @param p Probability of success.
 * @throws OutOfRangeException if {@code p <= 0} or {@code p > 1}.
 */
public GeometricDistribution(RandomGenerator rng, double p) {
    super(rng);

    if (p <= 0 || p > 1) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_LEFT, p, 0, 1);
    }

    probabilityOfSuccess = p;
}
 
Example 12
Source File: StableRandomGenerator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new generator.
 *
 * @param generator underlying random generator to use
 * @param alpha Stability parameter. Must be in range (0, 2]
 * @param beta Skewness parameter. Must be in range [-1, 1]
 * @throws NullArgumentException if generator is null
 * @throws OutOfRangeException if {@code alpha <= 0} or {@code alpha > 2}
 * or {@code beta < -1} or {@code beta > 1}
 */
public StableRandomGenerator(final RandomGenerator generator,
                             final double alpha, final double beta)
    throws NullArgumentException, OutOfRangeException {
    if (generator == null) {
        throw new NullArgumentException();
    }

    if (!(alpha > 0d && alpha <= 2d)) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_LEFT,
                alpha, 0, 2);
    }

    if (!(beta >= -1d && beta <= 1d)) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_SIMPLE,
                beta, -1, 1);
    }

    this.generator = generator;
    this.alpha = alpha;
    this.beta = beta;
    if (alpha < 2d && beta != 0d) {
        zeta = beta * FastMath.tan(FastMath.PI * alpha / 2);
    } else {
        zeta = 0d;
    }
}