http://git-wip-us.apache.org/repos/asf/commons-complex/blob/b3576eeb/site-content/.svn/pristine/05/05c55503e74f7e69c60cdafe0d5e6796696f6b94.svn-base ---------------------------------------------------------------------- diff --git a/site-content/.svn/pristine/05/05c55503e74f7e69c60cdafe0d5e6796696f6b94.svn-base b/site-content/.svn/pristine/05/05c55503e74f7e69c60cdafe0d5e6796696f6b94.svn-base deleted file mode 100644 index b4930a4..0000000 --- a/site-content/.svn/pristine/05/05c55503e74f7e69c60cdafe0d5e6796696f6b94.svn-base +++ /dev/null @@ -1,783 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>RandomDataGenerator.java</title><link rel="stylesheet" href="../.resources/prettify.css" type="text/css"/><script type="text/javascript" src="../.resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Math</a> > <a href="index.source.html" class="el_package">org.apache.commons.math3.random</a> > <span class="el_source">RandomDataGenerator.ja va</span></div><h1>RandomDataGenerator.java</h1><pre class="source lang-java linenums">/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math3.random; - -import java.io.Serializable; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.security.NoSuchProviderException; -import java.security.SecureRandom; -import java.util.Collection; - -import org.apache.commons.math3.distribution.BetaDistribution; -import org.apache.commons.math3.distribution.BinomialDistribution; -import org.apache.commons.math3.distribution.CauchyDistribution; -import org.apache.commons.math3.distribution.ChiSquaredDistribution; -import org.apache.commons.math3.distribution.ExponentialDistribution; -import org.apache.commons.math3.distribution.FDistribution; -import org.apache.commons.math3.distribution.GammaDistribution; -import org.apache.commons.math3.distribution.HypergeometricDistribution; -import org.apache.commons.math3.distribution.PascalDistribution; -import org.apache.commons.math3.distribution.PoissonDistribution; -import org.apache.commons.math3.distribution.TDistribution; -import org.apache.commons.math3.distribution.WeibullDistribution; -import org.apache.commons.math3.distribution.ZipfDistribution; -import org.apache.commons.math3.distribution.UniformIntegerDistribution; -import org.apache.commons.math3.exception.MathInternalError; -import org.apache.commons.math3.exception.NotANumberException; -import org.apache.commons.math3.exception.NotFiniteNumberException; -import org.apache.commons.math3.exception.NotPositiveException; -import org.apache.commons.math3.exception.NotStrictlyPositiveException; -import org.apache.commons.math3.exception.NumberIsTooLargeException; -import org.apache.commons.math3.exception.OutOfRangeException; -import org.apache.commons.math3.exception.util.LocalizedFormats; -import org.apache.commons.math3.util.MathArrays; - -/** - * Implements the {@link RandomData} interface using a {@link RandomGenerator} - * instance to generate non-secure data and a {@link java.security.SecureRandom} - * instance to provide data for the <code>nextSecureXxx</code> methods. If no - * <code>RandomGenerator</code> is provided in the constructor, the default is - * to use a {@link Well19937c} generator. To plug in a different - * implementation, either implement <code>RandomGenerator</code> directly or - * extend {@link AbstractRandomGenerator}. - * <p> - * Supports reseeding the underlying pseudo-random number generator (PRNG). The - * <code>SecurityProvider</code> and <code>Algorithm</code> used by the - * <code>SecureRandom</code> instance can also be reset. - * </p> - * <p> - * For details on the default PRNGs, see {@link java.util.Random} and - * {@link java.security.SecureRandom}. - * </p> - * <p> - * <strong>Usage Notes</strong>: - * <ul> - * <li> - * Instance variables are used to maintain <code>RandomGenerator</code> and - * <code>SecureRandom</code> instances used in data generation. Therefore, to - * generate a random sequence of values or strings, you should use just - * <strong>one</strong> <code>RandomDataImpl</code> instance repeatedly.</li> - * <li> - * The "secure" methods are *much* slower. These should be used only when a - * cryptographically secure random sequence is required. A secure random - * sequence is a sequence of pseudo-random values which, in addition to being - * well-dispersed (so no subsequence of values is an any more likely than other - * subsequence of the the same length), also has the additional property that - * knowledge of values generated up to any point in the sequence does not make - * it any easier to predict subsequent values.</li> - * <li> - * When a new <code>RandomDataImpl</code> is created, the underlying random - * number generators are <strong>not</strong> initialized. If you do not - * explicitly seed the default non-secure generator, it is seeded with the - * current time in milliseconds plus the system identity hash code on first use. - * The same holds for the secure generator. If you provide a <code>RandomGenerator</code> - * to the constructor, however, this generator is not reseeded by the constructor - * nor is it reseeded on first use.</li> - * <li> - * The <code>reSeed</code> and <code>reSeedSecure</code> methods delegate to the - * corresponding methods on the underlying <code>RandomGenerator</code> and - * <code>SecureRandom</code> instances. Therefore, <code>reSeed(long)</code> - * fully resets the initial state of the non-secure random number generator (so - * that reseeding with a specific value always results in the same subsequent - * random sequence); whereas reSeedSecure(long) does <strong>not</strong> - * reinitialize the secure random number generator (so secure sequences started - * with calls to reseedSecure(long) won't be identical).</li> - * <li> - * This implementation is not synchronized. The underlying <code>RandomGenerator</code> - * or <code>SecureRandom</code> instances are not protected by synchronization and - * are not guaranteed to be thread-safe. Therefore, if an instance of this class - * is concurrently utilized by multiple threads, it is the responsibility of - * client code to synchronize access to seeding and data generation methods. - * </li> - * </ul> - * </p> - * @since 3.1 - */ -public class RandomDataGenerator implements RandomData, Serializable { - - /** Serializable version identifier */ - private static final long serialVersionUID = -626730818244969716L; - - /** underlying random number generator */ -<span class="fc" id="L118"> private RandomGenerator rand = null;</span> - - /** underlying secure random number generator */ -<span class="fc" id="L121"> private RandomGenerator secRand = null;</span> - - /** - * Construct a RandomDataGenerator, using a default random generator as the source - * of randomness. - * - * <p>The default generator is a {@link Well19937c} seeded - * with {@code System.currentTimeMillis() + System.identityHashCode(this))}. - * The generator is initialized and seeded on first use.</p> - */ -<span class="fc" id="L131"> public RandomDataGenerator() {</span> -<span class="fc" id="L132"> }</span> - - /** - * Construct a RandomDataGenerator using the supplied {@link RandomGenerator} as - * the source of (non-secure) random data. - * - * @param rand the source of (non-secure) random data - * (may be null, resulting in the default generator) - */ -<span class="fc" id="L141"> public RandomDataGenerator(RandomGenerator rand) {</span> -<span class="fc" id="L142"> this.rand = rand;</span> -<span class="fc" id="L143"> }</span> - - /** - * {@inheritDoc} - * <p> - * <strong>Algorithm Description:</strong> hex strings are generated using a - * 2-step process. - * <ol> - * <li>{@code len / 2 + 1} binary bytes are generated using the underlying - * Random</li> - * <li>Each binary byte is translated into 2 hex digits</li> - * </ol> - * </p> - * - * @param len the desired string length. - * @return the random string. - * @throws NotStrictlyPositiveException if {@code len <= 0}. - */ - public String nextHexString(int len) throws NotStrictlyPositiveException { -<span class="fc bfc" id="L162" title="All 2 branches covered."> if (len <= 0) {</span> -<span class="fc" id="L163"> throw new NotStrictlyPositiveException(LocalizedFormats.LENGTH, len);</span> - } - - // Get a random number generator -<span class="fc" id="L167"> RandomGenerator ran = getRandomGenerator();</span> - - // Initialize output buffer -<span class="fc" id="L170"> StringBuilder outBuffer = new StringBuilder();</span> - - // Get int(len/2)+1 random bytes -<span class="fc" id="L173"> byte[] randomBytes = new byte[(len / 2) + 1];</span> -<span class="fc" id="L174"> ran.nextBytes(randomBytes);</span> - - // Convert each byte to 2 hex digits -<span class="fc bfc" id="L177" title="All 2 branches covered."> for (int i = 0; i < randomBytes.length; i++) {</span> -<span class="fc" id="L178"> Integer c = Integer.valueOf(randomBytes[i]);</span> - - /* - * Add 128 to byte value to make interval 0-255 before doing hex - * conversion. This guarantees <= 2 hex digits from toHexString() - * toHexString would otherwise add 2^32 to negative arguments. - */ -<span class="fc" id="L185"> String hex = Integer.toHexString(c.intValue() + 128);</span> - - // Make sure we add 2 hex digits for each byte -<span class="fc bfc" id="L188" title="All 2 branches covered."> if (hex.length() == 1) {</span> -<span class="fc" id="L189"> hex = "0" + hex;</span> - } -<span class="fc" id="L191"> outBuffer.append(hex);</span> - } -<span class="fc" id="L193"> return outBuffer.toString().substring(0, len);</span> - } - - /** {@inheritDoc} */ - public int nextInt(final int lower, final int upper) throws NumberIsTooLargeException { -<span class="fc" id="L198"> return new UniformIntegerDistribution(getRandomGenerator(), lower, upper).sample();</span> - } - - /** {@inheritDoc} */ - public long nextLong(final long lower, final long upper) throws NumberIsTooLargeException { -<span class="fc bfc" id="L203" title="All 2 branches covered."> if (lower >= upper) {</span> -<span class="fc" id="L204"> throw new NumberIsTooLargeException(LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,</span> - lower, upper, false); - } -<span class="fc" id="L207"> final long max = (upper - lower) + 1;</span> -<span class="fc bfc" id="L208" title="All 2 branches covered."> if (max <= 0) {</span> - // the range is too wide to fit in a positive long (larger than 2^63); as it covers - // more than half the long range, we use directly a simple rejection method -<span class="fc" id="L211"> final RandomGenerator rng = getRandomGenerator();</span> - while (true) { -<span class="fc" id="L213"> final long r = rng.nextLong();</span> -<span class="fc bfc" id="L214" title="All 4 branches covered."> if (r >= lower && r <= upper) {</span> -<span class="fc" id="L215"> return r;</span> - } -<span class="fc" id="L217"> }</span> -<span class="pc bpc" id="L218" title="1 of 2 branches missed."> } else if (max < Integer.MAX_VALUE){</span> - // we can shift the range and generate directly a positive int -<span class="fc" id="L220"> return lower + getRandomGenerator().nextInt((int) max);</span> - } else { - // we can shift the range and generate directly a positive long -<span class="nc" id="L223"> return lower + nextLong(getRandomGenerator(), max);</span> - } - } - - /** - * Returns a pseudorandom, uniformly distributed {@code long} value - * between 0 (inclusive) and the specified value (exclusive), drawn from - * this random number generator's sequence. - * - * @param rng random generator to use - * @param n the bound on the random number to be returned. Must be - * positive. - * @return a pseudorandom, uniformly distributed {@code long} - * value between 0 (inclusive) and n (exclusive). - * @throws IllegalArgumentException if n is not positive. - */ - private static long nextLong(final RandomGenerator rng, final long n) throws IllegalArgumentException { -<span class="nc bnc" id="L240" title="All 2 branches missed."> if (n > 0) {</span> -<span class="nc" id="L241"> final byte[] byteArray = new byte[8];</span> - long bits; - long val; - do { -<span class="nc" id="L245"> rng.nextBytes(byteArray);</span> -<span class="nc" id="L246"> bits = 0;</span> -<span class="nc bnc" id="L247" title="All 2 branches missed."> for (final byte b : byteArray) {</span> -<span class="nc" id="L248"> bits = (bits << 8) | (((long) b) & 0xffL);</span> - } -<span class="nc" id="L250"> bits &= 0x7fffffffffffffffL;</span> -<span class="nc" id="L251"> val = bits % n;</span> -<span class="nc bnc" id="L252" title="All 2 branches missed."> } while (bits - val + (n - 1) < 0);</span> -<span class="nc" id="L253"> return val;</span> - } -<span class="nc" id="L255"> throw new NotStrictlyPositiveException(n);</span> - } - - /** - * {@inheritDoc} - * <p> - * <strong>Algorithm Description:</strong> hex strings are generated in - * 40-byte segments using a 3-step process. - * <ol> - * <li> - * 20 random bytes are generated using the underlying - * <code>SecureRandom</code>.</li> - * <li> - * SHA-1 hash is applied to yield a 20-byte binary digest.</li> - * <li> - * Each byte of the binary digest is converted to 2 hex digits.</li> - * </ol> - * </p> - * @throws NotStrictlyPositiveException if {@code len <= 0} - */ - public String nextSecureHexString(int len) throws NotStrictlyPositiveException { -<span class="fc bfc" id="L276" title="All 2 branches covered."> if (len <= 0) {</span> -<span class="fc" id="L277"> throw new NotStrictlyPositiveException(LocalizedFormats.LENGTH, len);</span> - } - - // Get SecureRandom and setup Digest provider -<span class="fc" id="L281"> final RandomGenerator secRan = getSecRan();</span> -<span class="fc" id="L282"> MessageDigest alg = null;</span> - try { -<span class="fc" id="L284"> alg = MessageDigest.getInstance("SHA-1");</span> -<span class="nc" id="L285"> } catch (NoSuchAlgorithmException ex) {</span> - // this should never happen -<span class="nc" id="L287"> throw new MathInternalError(ex);</span> -<span class="fc" id="L288"> }</span> -<span class="fc" id="L289"> alg.reset();</span> - - // Compute number of iterations required (40 bytes each) -<span class="fc" id="L292"> int numIter = (len / 40) + 1;</span> - -<span class="fc" id="L294"> StringBuilder outBuffer = new StringBuilder();</span> -<span class="fc bfc" id="L295" title="All 2 branches covered."> for (int iter = 1; iter < numIter + 1; iter++) {</span> -<span class="fc" id="L296"> byte[] randomBytes = new byte[40];</span> -<span class="fc" id="L297"> secRan.nextBytes(randomBytes);</span> -<span class="fc" id="L298"> alg.update(randomBytes);</span> - - // Compute hash -- will create 20-byte binary hash -<span class="fc" id="L301"> byte[] hash = alg.digest();</span> - - // Loop over the hash, converting each byte to 2 hex digits -<span class="fc bfc" id="L304" title="All 2 branches covered."> for (int i = 0; i < hash.length; i++) {</span> -<span class="fc" id="L305"> Integer c = Integer.valueOf(hash[i]);</span> - - /* - * Add 128 to byte value to make interval 0-255 This guarantees - * <= 2 hex digits from toHexString() toHexString would - * otherwise add 2^32 to negative arguments - */ -<span class="fc" id="L312"> String hex = Integer.toHexString(c.intValue() + 128);</span> - - // Keep strings uniform length -- guarantees 40 bytes -<span class="fc bfc" id="L315" title="All 2 branches covered."> if (hex.length() == 1) {</span> -<span class="fc" id="L316"> hex = "0" + hex;</span> - } -<span class="fc" id="L318"> outBuffer.append(hex);</span> - } - } -<span class="fc" id="L321"> return outBuffer.toString().substring(0, len);</span> - } - - /** {@inheritDoc} */ - public int nextSecureInt(final int lower, final int upper) throws NumberIsTooLargeException { -<span class="fc" id="L326"> return new UniformIntegerDistribution(getSecRan(), lower, upper).sample();</span> - } - - /** {@inheritDoc} */ - public long nextSecureLong(final long lower, final long upper) throws NumberIsTooLargeException { -<span class="fc bfc" id="L331" title="All 2 branches covered."> if (lower >= upper) {</span> -<span class="fc" id="L332"> throw new NumberIsTooLargeException(LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,</span> - lower, upper, false); - } -<span class="fc" id="L335"> final RandomGenerator rng = getSecRan();</span> -<span class="fc" id="L336"> final long max = (upper - lower) + 1;</span> -<span class="pc bpc" id="L337" title="1 of 2 branches missed."> if (max <= 0) {</span> - // the range is too wide to fit in a positive long (larger than 2^63); as it covers - // more than half the long range, we use directly a simple rejection method - while (true) { -<span class="nc" id="L341"> final long r = rng.nextLong();</span> -<span class="nc bnc" id="L342" title="All 4 branches missed."> if (r >= lower && r <= upper) {</span> -<span class="nc" id="L343"> return r;</span> - } -<span class="nc" id="L345"> }</span> -<span class="pc bpc" id="L346" title="1 of 2 branches missed."> } else if (max < Integer.MAX_VALUE){</span> - // we can shift the range and generate directly a positive int -<span class="fc" id="L348"> return lower + rng.nextInt((int) max);</span> - } else { - // we can shift the range and generate directly a positive long -<span class="nc" id="L351"> return lower + nextLong(rng, max);</span> - } - } - - /** - * {@inheritDoc} - * <p> - * <strong>Algorithm Description</strong>: - * <ul><li> For small means, uses simulation of a Poisson process - * using Uniform deviates, as described - * <a href="http://irmi.epfl.ch/cmos/Pmmi/interactive/rng7.htm"> here.</a> - * The Poisson process (and hence value returned) is bounded by 1000 * mean.</li> - * - * <li> For large means, uses the rejection algorithm described in <br/> - * Devroye, Luc. (1981).<i>The Computer Generation of Poisson Random Variables</i> - * <strong>Computing</strong> vol. 26 pp. 197-207.</li></ul></p> - * @throws NotStrictlyPositiveException if {@code len <= 0} - */ - public long nextPoisson(double mean) throws NotStrictlyPositiveException { -<span class="fc" id="L370"> return new PoissonDistribution(getRandomGenerator(), mean,</span> - PoissonDistribution.DEFAULT_EPSILON, - PoissonDistribution.DEFAULT_MAX_ITERATIONS).sample(); - } - - /** {@inheritDoc} */ - public double nextGaussian(double mu, double sigma) throws NotStrictlyPositiveException { -<span class="fc bfc" id="L377" title="All 2 branches covered."> if (sigma <= 0) {</span> -<span class="fc" id="L378"> throw new NotStrictlyPositiveException(LocalizedFormats.STANDARD_DEVIATION, sigma);</span> - } -<span class="fc" id="L380"> return sigma * getRandomGenerator().nextGaussian() + mu;</span> - } - - /** - * {@inheritDoc} - * - * <p> - * <strong>Algorithm Description</strong>: Uses the Algorithm SA (Ahrens) - * from p. 876 in: - * [1]: Ahrens, J. H. and Dieter, U. (1972). Computer methods for - * sampling from the exponential and normal distributions. - * Communications of the ACM, 15, 873-882. - * </p> - */ - public double nextExponential(double mean) throws NotStrictlyPositiveException { -<span class="fc" id="L395"> return new ExponentialDistribution(getRandomGenerator(), mean,</span> - ExponentialDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY).sample(); - } - - /** - * <p>Generates a random value from the - * {@link org.apache.commons.math3.distribution.GammaDistribution Gamma Distribution}.</p> - * - * <p>This implementation uses the following algorithms: </p> - * - * <p>For 0 < shape < 1: <br/> - * Ahrens, J. H. and Dieter, U., <i>Computer methods for - * sampling from gamma, beta, Poisson and binomial distributions.</i> - * Computing, 12, 223-246, 1974.</p> - * - * <p>For shape >= 1: <br/> - * Marsaglia and Tsang, <i>A Simple Method for Generating - * Gamma Variables.</i> ACM Transactions on Mathematical Software, - * Volume 26 Issue 3, September, 2000.</p> - * - * @param shape the median of the Gamma distribution - * @param scale the scale parameter of the Gamma distribution - * @return random value sampled from the Gamma(shape, scale) distribution - * @throws NotStrictlyPositiveException if {@code shape <= 0} or - * {@code scale <= 0}. - */ - public double nextGamma(double shape, double scale) throws NotStrictlyPositiveException { -<span class="fc" id="L422"> return new GammaDistribution(getRandomGenerator(),shape, scale,</span> - GammaDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY).sample(); - } - - /** - * Generates a random value from the {@link HypergeometricDistribution Hypergeometric Distribution}. - * - * @param populationSize the population size of the Hypergeometric distribution - * @param numberOfSuccesses number of successes in the population of the Hypergeometric distribution - * @param sampleSize the sample size of the Hypergeometric distribution - * @return random value sampled from the Hypergeometric(numberOfSuccesses, sampleSize) distribution - * @throws NumberIsTooLargeException if {@code numberOfSuccesses > populationSize}, - * or {@code sampleSize > populationSize}. - * @throws NotStrictlyPositiveException if {@code populationSize <= 0}. - * @throws NotPositiveException if {@code numberOfSuccesses < 0}. - */ - public int nextHypergeometric(int populationSize, int numberOfSuccesses, int sampleSize) throws NotPositiveException, NotStrictlyPositiveException, NumberIsTooLargeException { -<span class="fc" id="L439"> return new HypergeometricDistribution(getRandomGenerator(),populationSize,</span> - numberOfSuccesses, sampleSize).sample(); - } - - /** - * Generates a random value from the {@link PascalDistribution Pascal Distribution}. - * - * @param r the number of successes of the Pascal distribution - * @param p the probability of success of the Pascal distribution - * @return random value sampled from the Pascal(r, p) distribution - * @throws NotStrictlyPositiveException if the number of successes is not positive - * @throws OutOfRangeException if the probability of success is not in the - * range {@code [0, 1]}. - */ - public int nextPascal(int r, double p) throws NotStrictlyPositiveException, OutOfRangeException { -<span class="fc" id="L454"> return new PascalDistribution(getRandomGenerator(), r, p).sample();</span> - } - - /** - * Generates a random value from the {@link TDistribution T Distribution}. - * - * @param df the degrees of freedom of the T distribution - * @return random value from the T(df) distribution - * @throws NotStrictlyPositiveException if {@code df <= 0} - */ - public double nextT(double df) throws NotStrictlyPositiveException { -<span class="fc" id="L465"> return new TDistribution(getRandomGenerator(), df,</span> - TDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY).sample(); - } - - /** - * Generates a random value from the {@link WeibullDistribution Weibull Distribution}. - * - * @param shape the shape parameter of the Weibull distribution - * @param scale the scale parameter of the Weibull distribution - * @return random value sampled from the Weibull(shape, size) distribution - * @throws NotStrictlyPositiveException if {@code shape <= 0} or - * {@code scale <= 0}. - */ - public double nextWeibull(double shape, double scale) throws NotStrictlyPositiveException { -<span class="fc" id="L479"> return new WeibullDistribution(getRandomGenerator(), shape, scale,</span> - WeibullDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY).sample(); - } - - /** - * Generates a random value from the {@link ZipfDistribution Zipf Distribution}. - * - * @param numberOfElements the number of elements of the ZipfDistribution - * @param exponent the exponent of the ZipfDistribution - * @return random value sampled from the Zipf(numberOfElements, exponent) distribution - * @exception NotStrictlyPositiveException if {@code numberOfElements <= 0} - * or {@code exponent <= 0}. - */ - public int nextZipf(int numberOfElements, double exponent) throws NotStrictlyPositiveException { -<span class="fc" id="L493"> return new ZipfDistribution(getRandomGenerator(), numberOfElements, exponent).sample();</span> - } - - /** - * Generates a random value from the {@link BetaDistribution Beta Distribution}. - * - * @param alpha first distribution shape parameter - * @param beta second distribution shape parameter - * @return random value sampled from the beta(alpha, beta) distribution - */ - public double nextBeta(double alpha, double beta) { -<span class="fc" id="L504"> return new BetaDistribution(getRandomGenerator(), alpha, beta,</span> - BetaDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY).sample(); - } - - /** - * Generates a random value from the {@link BinomialDistribution Binomial Distribution}. - * - * @param numberOfTrials number of trials of the Binomial distribution - * @param probabilityOfSuccess probability of success of the Binomial distribution - * @return random value sampled from the Binomial(numberOfTrials, probabilityOfSuccess) distribution - */ - public int nextBinomial(int numberOfTrials, double probabilityOfSuccess) { -<span class="fc" id="L516"> return new BinomialDistribution(getRandomGenerator(), numberOfTrials, probabilityOfSuccess).sample();</span> - } - - /** - * Generates a random value from the {@link CauchyDistribution Cauchy Distribution}. - * - * @param median the median of the Cauchy distribution - * @param scale the scale parameter of the Cauchy distribution - * @return random value sampled from the Cauchy(median, scale) distribution - */ - public double nextCauchy(double median, double scale) { -<span class="fc" id="L527"> return new CauchyDistribution(getRandomGenerator(), median, scale,</span> - CauchyDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY).sample(); - } - - /** - * Generates a random value from the {@link ChiSquaredDistribution ChiSquare Distribution}. - * - * @param df the degrees of freedom of the ChiSquare distribution - * @return random value sampled from the ChiSquare(df) distribution - */ - public double nextChiSquare(double df) { -<span class="fc" id="L538"> return new ChiSquaredDistribution(getRandomGenerator(), df,</span> - ChiSquaredDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY).sample(); - } - - /** - * Generates a random value from the {@link FDistribution F Distribution}. - * - * @param numeratorDf the numerator degrees of freedom of the F distribution - * @param denominatorDf the denominator degrees of freedom of the F distribution - * @return random value sampled from the F(numeratorDf, denominatorDf) distribution - * @throws NotStrictlyPositiveException if - * {@code numeratorDf <= 0} or {@code denominatorDf <= 0}. - */ - public double nextF(double numeratorDf, double denominatorDf) throws NotStrictlyPositiveException { -<span class="fc" id="L552"> return new FDistribution(getRandomGenerator(), numeratorDf, denominatorDf,</span> - FDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY).sample(); - } - - /** - * {@inheritDoc} - * - * <p> - * <strong>Algorithm Description</strong>: scales the output of - * Random.nextDouble(), but rejects 0 values (i.e., will generate another - * random double if Random.nextDouble() returns 0). This is necessary to - * provide a symmetric output interval (both endpoints excluded). - * </p> - * @throws NumberIsTooLargeException if {@code lower >= upper} - * @throws NotFiniteNumberException if one of the bounds is infinite - * @throws NotANumberException if one of the bounds is NaN - */ - public double nextUniform(double lower, double upper) - throws NumberIsTooLargeException, NotFiniteNumberException, NotANumberException { -<span class="fc" id="L571"> return nextUniform(lower, upper, false);</span> - } - - /** - * {@inheritDoc} - * - * <p> - * <strong>Algorithm Description</strong>: if the lower bound is excluded, - * scales the output of Random.nextDouble(), but rejects 0 values (i.e., - * will generate another random double if Random.nextDouble() returns 0). - * This is necessary to provide a symmetric output interval (both - * endpoints excluded). - * </p> - * - * @throws NumberIsTooLargeException if {@code lower >= upper} - * @throws NotFiniteNumberException if one of the bounds is infinite - * @throws NotANumberException if one of the bounds is NaN - */ - public double nextUniform(double lower, double upper, boolean lowerInclusive) - throws NumberIsTooLargeException, NotFiniteNumberException, NotANumberException { - -<span class="fc bfc" id="L592" title="All 2 branches covered."> if (lower >= upper) {</span> -<span class="fc" id="L593"> throw new NumberIsTooLargeException(LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,</span> - lower, upper, false); - } - -<span class="fc bfc" id="L597" title="All 2 branches covered."> if (Double.isInfinite(lower)) {</span> -<span class="fc" id="L598"> throw new NotFiniteNumberException(LocalizedFormats.INFINITE_BOUND, lower);</span> - } -<span class="fc bfc" id="L600" title="All 2 branches covered."> if (Double.isInfinite(upper)) {</span> -<span class="fc" id="L601"> throw new NotFiniteNumberException(LocalizedFormats.INFINITE_BOUND, upper);</span> - } - -<span class="fc bfc" id="L604" title="All 4 branches covered."> if (Double.isNaN(lower) || Double.isNaN(upper)) {</span> -<span class="fc" id="L605"> throw new NotANumberException();</span> - } - -<span class="fc" id="L608"> final RandomGenerator generator = getRandomGenerator();</span> - - // ensure nextDouble() isn't 0.0 -<span class="fc" id="L611"> double u = generator.nextDouble();</span> -<span class="pc bpc" id="L612" title="2 of 4 branches missed."> while (!lowerInclusive && u <= 0.0) {</span> -<span class="nc" id="L613"> u = generator.nextDouble();</span> - } - -<span class="fc" id="L616"> return u * upper + (1.0 - u) * lower;</span> - } - - /** - * {@inheritDoc} - * - * This method calls {@link MathArrays#shuffle(int[],RandomGenerator) - * MathArrays.shuffle} in order to create a random shuffle of the set - * of natural numbers {@code { 0, 1, ..., n - 1 }}. - * - * @throws NumberIsTooLargeException if {@code k > n}. - * @throws NotStrictlyPositiveException if {@code k <= 0}. - */ - public int[] nextPermutation(int n, int k) - throws NumberIsTooLargeException, NotStrictlyPositiveException { -<span class="pc bpc" id="L631" title="1 of 2 branches missed."> if (k > n) {</span> -<span class="nc" id="L632"> throw new NumberIsTooLargeException(LocalizedFormats.PERMUTATION_EXCEEDS_N,</span> - k, n, true); - } -<span class="pc bpc" id="L635" title="1 of 2 branches missed."> if (k <= 0) {</span> -<span class="nc" id="L636"> throw new NotStrictlyPositiveException(LocalizedFormats.PERMUTATION_SIZE,</span> - k); - } - -<span class="fc" id="L640"> int[] index = MathArrays.natural(n);</span> -<span class="fc" id="L641"> MathArrays.shuffle(index, getRandomGenerator());</span> - - // Return a new array containing the first "k" entries of "index". -<span class="fc" id="L644"> return MathArrays.copyOf(index, k);</span> - } - - /** - * {@inheritDoc} - * - * This method calls {@link #nextPermutation(int,int) nextPermutation(c.size(), k)} - * in order to sample the collection. - */ - public Object[] nextSample(Collection<?> c, int k) throws NumberIsTooLargeException, NotStrictlyPositiveException { - -<span class="fc" id="L655"> int len = c.size();</span> -<span class="fc bfc" id="L656" title="All 2 branches covered."> if (k > len) {</span> -<span class="fc" id="L657"> throw new NumberIsTooLargeException(LocalizedFormats.SAMPLE_SIZE_EXCEEDS_COLLECTION_SIZE,</span> - k, len, true); - } -<span class="fc bfc" id="L660" title="All 2 branches covered."> if (k <= 0) {</span> -<span class="fc" id="L661"> throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES, k);</span> - } - -<span class="fc" id="L664"> Object[] objects = c.toArray();</span> -<span class="fc" id="L665"> int[] index = nextPermutation(len, k);</span> -<span class="fc" id="L666"> Object[] result = new Object[k];</span> -<span class="fc bfc" id="L667" title="All 2 branches covered."> for (int i = 0; i < k; i++) {</span> -<span class="fc" id="L668"> result[i] = objects[index[i]];</span> - } -<span class="fc" id="L670"> return result;</span> - } - - - - /** - * Reseeds the random number generator with the supplied seed. - * <p> - * Will create and initialize if null. - * </p> - * - * @param seed the seed value to use - */ - public void reSeed(long seed) { -<span class="fc" id="L684"> getRandomGenerator().setSeed(seed);</span> -<span class="fc" id="L685"> }</span> - - /** - * Reseeds the secure random number generator with the current time in - * milliseconds. - * <p> - * Will create and initialize if null. - * </p> - */ - public void reSeedSecure() { -<span class="fc" id="L695"> getSecRan().setSeed(System.currentTimeMillis());</span> -<span class="fc" id="L696"> }</span> - - /** - * Reseeds the secure random number generator with the supplied seed. - * <p> - * Will create and initialize if null. - * </p> - * - * @param seed the seed value to use - */ - public void reSeedSecure(long seed) { -<span class="fc" id="L707"> getSecRan().setSeed(seed);</span> -<span class="fc" id="L708"> }</span> - - /** - * Reseeds the random number generator with - * {@code System.currentTimeMillis() + System.identityHashCode(this))}. - */ - public void reSeed() { -<span class="fc" id="L715"> getRandomGenerator().setSeed(System.currentTimeMillis() + System.identityHashCode(this));</span> -<span class="fc" id="L716"> }</span> - - /** - * Sets the PRNG algorithm for the underlying SecureRandom instance using - * the Security Provider API. The Security Provider API is defined in <a - * href = - * "http://java.sun.com/j2se/1.3/docs/guide/security/CryptoSpec.html#AppA"> - * Java Cryptography Architecture API Specification & Reference.</a> - * <p> - * <strong>USAGE NOTE:</strong> This method carries <i>significant</i> - * overhead and may take several seconds to execute. - * </p> - * - * @param algorithm the name of the PRNG algorithm - * @param provider the name of the provider - * @throws NoSuchAlgorithmException if the specified algorithm is not available - * @throws NoSuchProviderException if the specified provider is not installed - */ - public void setSecureAlgorithm(String algorithm, String provider) - throws NoSuchAlgorithmException, NoSuchProviderException { -<span class="nc" id="L736"> secRand = RandomGeneratorFactory.createRandomGenerator(SecureRandom.getInstance(algorithm, provider));</span> -<span class="nc" id="L737"> }</span> - - /** - * Returns the RandomGenerator used to generate non-secure random data. - * <p> - * Creates and initializes a default generator if null. Uses a {@link Well19937c} - * generator with {@code System.currentTimeMillis() + System.identityHashCode(this))} - * as the default seed. - * </p> - * - * @return the Random used to generate random data - * @since 3.2 - */ - public RandomGenerator getRandomGenerator() { -<span class="fc bfc" id="L751" title="All 2 branches covered."> if (rand == null) {</span> -<span class="fc" id="L752"> initRan();</span> - } -<span class="fc" id="L754"> return rand;</span> - } - - /** - * Sets the default generator to a {@link Well19937c} generator seeded with - * {@code System.currentTimeMillis() + System.identityHashCode(this))}. - */ - private void initRan() { -<span class="fc" id="L762"> rand = new Well19937c(System.currentTimeMillis() + System.identityHashCode(this));</span> -<span class="fc" id="L763"> }</span> - - /** - * Returns the SecureRandom used to generate secure random data. - * <p> - * Creates and initializes if null. Uses - * {@code System.currentTimeMillis() + System.identityHashCode(this)} as the default seed. - * </p> - * - * @return the SecureRandom used to generate secure random data, wrapped in a - * {@link RandomGenerator}. - */ - private RandomGenerator getSecRan() { -<span class="fc bfc" id="L776" title="All 2 branches covered."> if (secRand == null) {</span> -<span class="fc" id="L777"> secRand = RandomGeneratorFactory.createRandomGenerator(new SecureRandom());</span> -<span class="fc" id="L778"> secRand.setSeed(System.currentTimeMillis() + System.identityHashCode(this));</span> - } -<span class="fc" id="L780"> return secRand;</span> - } -} -</pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.5.201505241946</span></div></body></html> \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/commons-complex/blob/b3576eeb/site-content/.svn/pristine/05/05cc158164f15697d03a8686521fc02724f167a0.svn-base ---------------------------------------------------------------------- diff --git a/site-content/.svn/pristine/05/05cc158164f15697d03a8686521fc02724f167a0.svn-base b/site-content/.svn/pristine/05/05cc158164f15697d03a8686521fc02724f167a0.svn-base deleted file mode 100644 index e1422f0..0000000 --- a/site-content/.svn/pristine/05/05cc158164f15697d03a8686521fc02724f167a0.svn-base +++ /dev/null @@ -1,117 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<!-- NewPage --> -<html lang="en"> -<head> -<meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> -<title>Uses of Class org.apache.commons.math3.geometry.euclidean.oned.IntervalsSetTest (Apache Commons Math 3.5 Test API)</title> -<link rel="stylesheet" type="text/css" href="../../../../../../../../stylesheet.css" title="Style"> -</head> -<body> -<script type="text/javascript"><!-- - if (location.href.indexOf('is-external=true') == -1) { - parent.document.title="Uses of Class org.apache.commons.math3.geometry.euclidean.oned.IntervalsSetTest (Apache Commons Math 3.5 Test API)"; - } -//--> -</script> -<noscript> -<div>JavaScript is disabled on your browser.</div> -</noscript> -<!-- ========= START OF TOP NAVBAR ======= --> -<div class="topNav"><a name="navbar_top"> -<!-- --> -</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> -<!-- --> -</a> -<ul class="navList" title="Navigation"> -<li><a href="../../../../../../../../overview-summary.html">Overview</a></li> -<li><a href="../package-summary.html">Package</a></li> -<li><a href="../../../../../../../../org/apache/commons/math3/geometry/euclidean/oned/IntervalsSetTest.html" title="class in org.apache.commons.math3.geometry.euclidean.oned">Class</a></li> -<li class="navBarCell1Rev">Use</li> -<li><a href="../package-tree.html">Tree</a></li> -<li><a href="../../../../../../../../deprecated-list.html">Deprecated</a></li> -<li><a href="../../../../../../../../index-all.html">Index</a></li> -<li><a href="../../../../../../../../help-doc.html">Help</a></li> -</ul> -<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div> -</div> -<div class="subNav"> -<ul class="navList"> -<li>PREV</li> -<li>NEXT</li> -</ul> -<ul class="navList"> -<li><a href="../../../../../../../../index.html?org/apache/commons/math3/geometry/euclidean/oned//class-useIntervalsSetTest.html" target="_top">FRAMES</a></li> -<li><a href="IntervalsSetTest.html" target="_top">NO FRAMES</a></li> -</ul> -<ul class="navList" id="allclasses_navbar_top"> -<li><a href="../../../../../../../../allclasses-noframe.html">All Classes</a></li> -</ul> -<div> -<script type="text/javascript"><!-- - allClassesLink = document.getElementById("allclasses_navbar_top"); - if(window==top) { - allClassesLink.style.display = "block"; - } - else { - allClassesLink.style.display = "none"; - } - //--> -</script> -</div> -<a name="skip-navbar_top"> -<!-- --> -</a></div> -<!-- ========= END OF TOP NAVBAR ========= --> -<div class="header"> -<h2 title="Uses of Class org.apache.commons.math3.geometry.euclidean.oned.IntervalsSetTest" class="title">Uses of Class<br>org.apache.commons.math3.geometry.euclidean.oned.IntervalsSetTest</h2> -</div> -<div class="classUseContainer">No usage of org.apache.commons.math3.geometry.euclidean.oned.IntervalsSetTest</div> -<!-- ======= START OF BOTTOM NAVBAR ====== --> -<div class="bottomNav"><a name="navbar_bottom"> -<!-- --> -</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> -<!-- --> -</a> -<ul class="navList" title="Navigation"> -<li><a href="../../../../../../../../overview-summary.html">Overview</a></li> -<li><a href="../package-summary.html">Package</a></li> -<li><a href="../../../../../../../../org/apache/commons/math3/geometry/euclidean/oned/IntervalsSetTest.html" title="class in org.apache.commons.math3.geometry.euclidean.oned">Class</a></li> -<li class="navBarCell1Rev">Use</li> -<li><a href="../package-tree.html">Tree</a></li> -<li><a href="../../../../../../../../deprecated-list.html">Deprecated</a></li> -<li><a href="../../../../../../../../index-all.html">Index</a></li> -<li><a href="../../../../../../../../help-doc.html">Help</a></li> -</ul> -<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div> -</div> -<div class="subNav"> -<ul class="navList"> -<li>PREV</li> -<li>NEXT</li> -</ul> -<ul class="navList"> -<li><a href="../../../../../../../../index.html?org/apache/commons/math3/geometry/euclidean/oned//class-useIntervalsSetTest.html" target="_top">FRAMES</a></li> -<li><a href="IntervalsSetTest.html" target="_top">NO FRAMES</a></li> -</ul> -<ul class="navList" id="allclasses_navbar_bottom"> -<li><a href="../../../../../../../../allclasses-noframe.html">All Classes</a></li> -</ul> -<div> -<script type="text/javascript"><!-- - allClassesLink = document.getElementById("allclasses_navbar_bottom"); - if(window==top) { - allClassesLink.style.display = "block"; - } - else { - allClassesLink.style.display = "none"; - } - //--> -</script> -</div> -<a name="skip-navbar_bottom"> -<!-- --> -</a></div> -<!-- ======== END OF BOTTOM NAVBAR ======= --> -<p class="legalCopy"><small>Copyright © 2003–2015 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> -</body> -</html> http://git-wip-us.apache.org/repos/asf/commons-complex/blob/b3576eeb/site-content/.svn/pristine/05/05e77da34b2d9ca3c34941b19c62494d2a89fffa.svn-base ---------------------------------------------------------------------- diff --git a/site-content/.svn/pristine/05/05e77da34b2d9ca3c34941b19c62494d2a89fffa.svn-base b/site-content/.svn/pristine/05/05e77da34b2d9ca3c34941b19c62494d2a89fffa.svn-base deleted file mode 100644 index e0dcaaf..0000000 --- a/site-content/.svn/pristine/05/05e77da34b2d9ca3c34941b19c62494d2a89fffa.svn-base +++ /dev/null @@ -1,284 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<!-- NewPage --> -<html lang="en"> -<head> -<meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> -<title>BigFractionFieldTest (Apache Commons Math 3.5 Test API)</title> -<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> -</head> -<body> -<script type="text/javascript"><!-- - if (location.href.indexOf('is-external=true') == -1) { - parent.document.title="BigFractionFieldTest (Apache Commons Math 3.5 Test API)"; - } -//--> -</script> -<noscript> -<div>JavaScript is disabled on your browser.</div> -</noscript> -<!-- ========= START OF TOP NAVBAR ======= --> -<div class="topNav"><a name="navbar_top"> -<!-- --> -</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> -<!-- --> -</a> -<ul class="navList" title="Navigation"> -<li><a href="../../../../../overview-summary.html">Overview</a></li> -<li><a href="package-summary.html">Package</a></li> -<li class="navBarCell1Rev">Class</li> -<li><a href="class-use/BigFractionFieldTest.html">Use</a></li> -<li><a href="package-tree.html">Tree</a></li> -<li><a href="../../../../../deprecated-list.html">Deprecated</a></li> -<li><a href="../../../../../index-all.html">Index</a></li> -<li><a href="../../../../../help-doc.html">Help</a></li> -</ul> -<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div> -</div> -<div class="subNav"> -<ul class="navList"> -<li>PREV CLASS</li> -<li><a href="../../../../../org/apache/commons/math3/fraction/BigFractionFormatTest.html" title="class in org.apache.commons.math3.fraction"><span class="strong">NEXT CLASS</span></a></li> -</ul> -<ul class="navList"> -<li><a href="../../../../../index.html?org/apache/commons/math3/fraction/BigFractionFieldTest.html" target="_top">FRAMES</a></li> -<li><a href="BigFractionFieldTest.html" target="_top">NO FRAMES</a></li> -</ul> -<ul class="navList" id="allclasses_navbar_top"> -<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> -</ul> -<div> -<script type="text/javascript"><!-- - allClassesLink = document.getElementById("allclasses_navbar_top"); - if(window==top) { - allClassesLink.style.display = "block"; - } - else { - allClassesLink.style.display = "none"; - } - //--> -</script> -</div> -<div> -<ul class="subNavList"> -<li>SUMMARY: </li> -<li>NESTED | </li> -<li>FIELD | </li> -<li><a href="#constructor_summary">CONSTR</a> | </li> -<li><a href="#method_summary">METHOD</a></li> -</ul> -<ul class="subNavList"> -<li>DETAIL: </li> -<li>FIELD | </li> -<li><a href="#constructor_detail">CONSTR</a> | </li> -<li><a href="#method_detail">METHOD</a></li> -</ul> -</div> -<a name="skip-navbar_top"> -<!-- --> -</a></div> -<!-- ========= END OF TOP NAVBAR ========= --> -<!-- ======== START OF CLASS DATA ======== --> -<div class="header"> -<p class="subTitle">org.apache.commons.math3.fraction</p> -<h2 title="Class BigFractionFieldTest" class="title">Class BigFractionFieldTest</h2> -</div> -<div class="contentContainer"> -<ul class="inheritance"> -<li><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> -<li> -<ul class="inheritance"> -<li>org.apache.commons.math3.fraction.BigFractionFieldTest</li> -</ul> -</li> -</ul> -<div class="description"> -<ul class="blockList"> -<li class="blockList"> -<hr> -<br> -<pre>public class <a href="../../../../../src-html/org/apache/commons/math3/fraction/BigFractionFieldTest.html#line.24">BigFractionFieldTest</a> -extends <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre> -</li> -</ul> -</div> -<div class="summary"> -<ul class="blockList"> -<li class="blockList"> -<!-- ======== CONSTRUCTOR SUMMARY ======== --> -<ul class="blockList"> -<li class="blockList"><a name="constructor_summary"> -<!-- --> -</a> -<h3>Constructor Summary</h3> -<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> -<caption><span>Constructors</span><span class="tabEnd"> </span></caption> -<tr> -<th class="colOne" scope="col">Constructor and Description</th> -</tr> -<tr class="altColor"> -<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/math3/fraction/BigFractionFieldTest.html#BigFractionFieldTest()">BigFractionFieldTest</a></strong>()</code> </td> -</tr> -</table> -</li> -</ul> -<!-- ========== METHOD SUMMARY =========== --> -<ul class="blockList"> -<li class="blockList"><a name="method_summary"> -<!-- --> -</a> -<h3>Method Summary</h3> -<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> -<caption><span>Methods</span><span class="tabEnd"> </span></caption> -<tr> -<th class="colFirst" scope="col">Modifier and Type</th> -<th class="colLast" scope="col">Method and Description</th> -</tr> -<tr class="altColor"> -<td class="colFirst"><code>void</code></td> -<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/fraction/BigFractionFieldTest.html#testOne()">testOne</a></strong>()</code> </td> -</tr> -<tr class="rowColor"> -<td class="colFirst"><code>void</code></td> -<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/fraction/BigFractionFieldTest.html#testSerial()">testSerial</a></strong>()</code> </td> -</tr> -<tr class="altColor"> -<td class="colFirst"><code>void</code></td> -<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/fraction/BigFractionFieldTest.html#testZero()">testZero</a></strong>()</code> </td> -</tr> -</table> -<ul class="blockList"> -<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object"> -<!-- --> -</a> -<h3>Methods inherited from class java.lang.<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> -<code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang /Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li> -</ul> -</li> -</ul> -</li> -</ul> -</div> -<div class="details"> -<ul class="blockList"> -<li class="blockList"> -<!-- ========= CONSTRUCTOR DETAIL ======== --> -<ul class="blockList"> -<li class="blockList"><a name="constructor_detail"> -<!-- --> -</a> -<h3>Constructor Detail</h3> -<a name="BigFractionFieldTest()"> -<!-- --> -</a> -<ul class="blockListLast"> -<li class="blockList"> -<h4>BigFractionFieldTest</h4> -<pre>public <a href="../../../../../src-html/org/apache/commons/math3/fraction/BigFractionFieldTest.html#line.24">BigFractionFieldTest</a>()</pre> -</li> -</ul> -</li> -</ul> -<!-- ============ METHOD DETAIL ========== --> -<ul class="blockList"> -<li class="blockList"><a name="method_detail"> -<!-- --> -</a> -<h3>Method Detail</h3> -<a name="testZero()"> -<!-- --> -</a> -<ul class="blockList"> -<li class="blockList"> -<h4>testZero</h4> -<pre>public void <a href="../../../../../src-html/org/apache/commons/math3/fraction/BigFractionFieldTest.html#line.27">testZero</a>()</pre> -</li> -</ul> -<a name="testOne()"> -<!-- --> -</a> -<ul class="blockList"> -<li class="blockList"> -<h4>testOne</h4> -<pre>public void <a href="../../../../../src-html/org/apache/commons/math3/fraction/BigFractionFieldTest.html#line.32">testOne</a>()</pre> -</li> -</ul> -<a name="testSerial()"> -<!-- --> -</a> -<ul class="blockListLast"> -<li class="blockList"> -<h4>testSerial</h4> -<pre>public void <a href="../../../../../src-html/org/apache/commons/math3/fraction/BigFractionFieldTest.html#line.37">testSerial</a>()</pre> -</li> -</ul> -</li> -</ul> -</li> -</ul> -</div> -</div> -<!-- ========= END OF CLASS DATA ========= --> -<!-- ======= START OF BOTTOM NAVBAR ====== --> -<div class="bottomNav"><a name="navbar_bottom"> -<!-- --> -</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> -<!-- --> -</a> -<ul class="navList" title="Navigation"> -<li><a href="../../../../../overview-summary.html">Overview</a></li> -<li><a href="package-summary.html">Package</a></li> -<li class="navBarCell1Rev">Class</li> -<li><a href="class-use/BigFractionFieldTest.html">Use</a></li> -<li><a href="package-tree.html">Tree</a></li> -<li><a href="../../../../../deprecated-list.html">Deprecated</a></li> -<li><a href="../../../../../index-all.html">Index</a></li> -<li><a href="../../../../../help-doc.html">Help</a></li> -</ul> -<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div> -</div> -<div class="subNav"> -<ul class="navList"> -<li>PREV CLASS</li> -<li><a href="../../../../../org/apache/commons/math3/fraction/BigFractionFormatTest.html" title="class in org.apache.commons.math3.fraction"><span class="strong">NEXT CLASS</span></a></li> -</ul> -<ul class="navList"> -<li><a href="../../../../../index.html?org/apache/commons/math3/fraction/BigFractionFieldTest.html" target="_top">FRAMES</a></li> -<li><a href="BigFractionFieldTest.html" target="_top">NO FRAMES</a></li> -</ul> -<ul class="navList" id="allclasses_navbar_bottom"> -<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> -</ul> -<div> -<script type="text/javascript"><!-- - allClassesLink = document.getElementById("allclasses_navbar_bottom"); - if(window==top) { - allClassesLink.style.display = "block"; - } - else { - allClassesLink.style.display = "none"; - } - //--> -</script> -</div> -<div> -<ul class="subNavList"> -<li>SUMMARY: </li> -<li>NESTED | </li> -<li>FIELD | </li> -<li><a href="#constructor_summary">CONSTR</a> | </li> -<li><a href="#method_summary">METHOD</a></li> -</ul> -<ul class="subNavList"> -<li>DETAIL: </li> -<li>FIELD | </li> -<li><a href="#constructor_detail">CONSTR</a> | </li> -<li><a href="#method_detail">METHOD</a></li> -</ul> -</div> -<a name="skip-navbar_bottom"> -<!-- --> -</a></div> -<!-- ======== END OF BOTTOM NAVBAR ======= --> -<p class="legalCopy"><small>Copyright © 2003–2015 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> -</body> -</html> http://git-wip-us.apache.org/repos/asf/commons-complex/blob/b3576eeb/site-content/.svn/pristine/05/05f78fcd7f661e1425b88d468dd53e9e0b131851.svn-base ---------------------------------------------------------------------- diff --git a/site-content/.svn/pristine/05/05f78fcd7f661e1425b88d468dd53e9e0b131851.svn-base b/site-content/.svn/pristine/05/05f78fcd7f661e1425b88d468dd53e9e0b131851.svn-base deleted file mode 100644 index 4241b15..0000000 --- a/site-content/.svn/pristine/05/05f78fcd7f661e1425b88d468dd53e9e0b131851.svn-base +++ /dev/null @@ -1 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>org.apache.commons.math3.fraction</title><script type="text/javascript" src="../.resources/sort.js"></script></head><body onload="initialSort(['breadcrumb', 'coveragetable'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="index.source.html" class="el_source">Source Files</a><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Math</a> > <span class="el_package">org.apache.commons.math3.fraction</span></div><h1>org.apache.commons.math3.fraction</h1><table class="coverage " cellspacing="0" id="coveragetable"><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td><td class="sortable ctr1" id="l" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="m" onclick="toggleSort(this)">Classes</td></tr></the ad><tfoot><tr><td>Total</td><td class="bar">288 of 3,343</td><td class="ctr2">91%</td><td class="bar">48 of 342</td><td class="ctr2">86%</td><td class="ctr1">66</td><td class="ctr2">333</td><td class="ctr1">70</td><td class="ctr2">748</td><td class="ctr1">20</td><td class="ctr2">160</td><td class="ctr1">0</td><td class="ctr2">12</td></tr></tfoot><tbody><tr><td id="a1"><a href="BigFraction.html" class="el_class">BigFraction</a></td><td class="bar" id="b0"><img src="../.resources/redbar.gif" width="10" height="10" title="117" alt="117"/><img src="../.resources/greenbar.gif" width="109" height="10" title="1,212" alt="1,212"/></td><td class="ctr2" id="c4">91%</td><td class="bar" id="d0"><img src="../.resources/redbar.gif" width="20" height="10" title="26" alt="26"/><img src="../.resources/greenbar.gif" width="99" height="10" title="126" alt="126"/></td><td class="ctr2" id="e4">83%</td><td class="ctr1" id="f0">27</td><td class="ctr2" id="g0">131</td><td class="ctr1" id="h0">25</td><td cl ass="ctr2" id="i0">275</td><td class="ctr1" id="j2">3</td><td class="ctr2" id="k0">55</td><td class="ctr1" id="l0">0</td><td class="ctr2" id="m0">1</td></tr><tr><td id="a4"><a href="BigFractionFormat.html" class="el_class">BigFractionFormat</a></td><td class="bar" id="b1"><img src="../.resources/redbar.gif" width="2" height="10" title="33" alt="33"/><img src="../.resources/greenbar.gif" width="18" height="10" title="209" alt="209"/></td><td class="ctr2" id="c7">86%</td><td class="bar" id="d5"><img src="../.resources/redbar.gif" width="1" height="10" title="2" alt="2"/><img src="../.resources/greenbar.gif" width="15" height="10" title="19" alt="19"/></td><td class="ctr2" id="e2">90%</td><td class="ctr1" id="f2">7</td><td class="ctr2" id="g2">25</td><td class="ctr1" id="h3">8</td><td class="ctr2" id="i4">61</td><td class="ctr1" id="j1">5</td><td class="ctr2" id="k2">14</td><td class="ctr1" id="l1">0</td><td class="ctr2" id="m1">1</td></tr><tr><td id="a11"><a href="ProperFractionFormat .html" class="el_class">ProperFractionFormat</a></td><td class="bar" id="b2"><img src="../.resources/redbar.gif" width="2" height="10" title="31" alt="31"/><img src="../.resources/greenbar.gif" width="17" height="10" title="191" alt="191"/></td><td class="ctr2" id="c8">86%</td><td class="bar" id="d3"><img src="../.resources/redbar.gif" width="3" height="10" title="4" alt="4"/><img src="../.resources/greenbar.gif" width="11" height="10" title="15" alt="15"/></td><td class="ctr2" id="e5">79%</td><td class="ctr1" id="f4">5</td><td class="ctr2" id="g6">17</td><td class="ctr1" id="h1">9</td><td class="ctr2" id="i3">63</td><td class="ctr1" id="j4">1</td><td class="ctr2" id="k5">7</td><td class="ctr1" id="l2">0</td><td class="ctr2" id="m2">1</td></tr><tr><td id="a10"><a href="ProperBigFractionFormat.html" class="el_class">ProperBigFractionFormat</a></td><td class="bar" id="b3"><img src="../.resources/redbar.gif" width="2" height="10" title="29" alt="29"/><img src="../.resources/greenbar.gi f" width="17" height="10" title="199" alt="199"/></td><td class="ctr2" id="c6">87%</td><td class="bar" id="d2"><img src="../.resources/redbar.gif" width="3" height="10" title="4" alt="4"/><img src="../.resources/greenbar.gif" width="18" height="10" title="23" alt="23"/></td><td class="ctr2" id="e3">85%</td><td class="ctr1" id="f5">5</td><td class="ctr2" id="g3">21</td><td class="ctr1" id="h2">9</td><td class="ctr2" id="i2">67</td><td class="ctr1" id="j5">1</td><td class="ctr2" id="k6">7</td><td class="ctr1" id="l3">0</td><td class="ctr2" id="m3">1</td></tr><tr><td id="a5"><a href="Fraction.html" class="el_class">Fraction</a></td><td class="bar" id="b4"><img src="../.resources/redbar.gif" width="2" height="10" title="26" alt="26"/><img src="../.resources/greenbar.gif" width="80" height="10" title="895" alt="895"/></td><td class="ctr2" id="c3">97%</td><td class="bar" id="d1"><img src="../.resources/redbar.gif" width="6" height="10" title="8" alt="8"/><img src="../.resources/greenbar.g if" width="71" height="10" title="90" alt="90"/></td><td class="ctr2" id="e1">92%</td><td class="ctr1" id="f1">8</td><td class="ctr2" id="g1">81</td><td class="ctr1" id="h6">4</td><td class="ctr2" id="i1">171</td><td class="ctr1" id="j8">0</td><td class="ctr2" id="k1">32</td><td class="ctr1" id="l4">0</td><td class="ctr2" id="m4">1</td></tr><tr><td id="a9"><a href="FractionFormat.html" class="el_class">FractionFormat</a></td><td class="bar" id="b5"><img src="../.resources/redbar.gif" width="2" height="10" title="25" alt="25"/><img src="../.resources/greenbar.gif" width="15" height="10" title="172" alt="172"/></td><td class="ctr2" id="c5">87%</td><td class="bar" id="d6"><img src="../.resources/greenbar.gif" width="9" height="10" title="12" alt="12"/></td><td class="ctr2" id="e0">92%</td><td class="ctr1" id="f3">7</td><td class="ctr2" id="g4">21</td><td class="ctr1" id="h4">8</td><td class="ctr2" id="i5">51</td><td class="ctr1" id="j0">6</td><td class="ctr2" id="k3">14</td><td class=" ctr1" id="l5">0</td><td class="ctr2" id="m5">1</td></tr><tr><td id="a0"><a href="AbstractFormat.html" class="el_class">AbstractFormat</a></td><td class="bar" id="b6"><img src="../.resources/redbar.gif" width="1" height="10" title="21" alt="21"/><img src="../.resources/greenbar.gif" width="9" height="10" title="102" alt="102"/></td><td class="ctr2" id="c9">83%</td><td class="bar" id="d4"><img src="../.resources/redbar.gif" width="2" height="10" title="3" alt="3"/><img src="../.resources/greenbar.gif" width="7" height="10" title="9" alt="9"/></td><td class="ctr2" id="e6">75%</td><td class="ctr1" id="f6">5</td><td class="ctr2" id="g5">19</td><td class="ctr1" id="h5">5</td><td class="ctr2" id="i6">38</td><td class="ctr1" id="j3">2</td><td class="ctr2" id="k4">13</td><td class="ctr1" id="l6">0</td><td class="ctr2" id="m6">1</td></tr><tr><td id="a8"><a href="FractionField$LazyHolder.html" class="el_class">FractionField.LazyHolder</a></td><td class="bar" id="b7"/><td class="ctr2" id="c10"> 67%</td><td class="bar" id="d7"/><td class="ctr2" id="e7">n/a</td><td class="ctr1" id="f7">1</td><td class="ctr2" id="g9">2</td><td class="ctr1" id="h7">1</td><td class="ctr2" id="i10">2</td><td class="ctr1" id="j6">1</td><td class="ctr2" id="k9">2</td><td class="ctr1" id="l7">0</td><td class="ctr2" id="m7">1</td></tr><tr><td id="a3"><a href="BigFractionField$LazyHolder.html" class="el_class">BigFractionField.LazyHolder</a></td><td class="bar" id="b8"/><td class="ctr2" id="c11">67%</td><td class="bar" id="d8"/><td class="ctr2" id="e8">n/a</td><td class="ctr1" id="f8">1</td><td class="ctr2" id="g10">2</td><td class="ctr1" id="h8">1</td><td class="ctr2" id="i11">2</td><td class="ctr1" id="j7">1</td><td class="ctr2" id="k10">2</td><td class="ctr1" id="l8">0</td><td class="ctr2" id="m8">1</td></tr><tr><td id="a6"><a href="FractionConversionException.html" class="el_class">FractionConversionException</a></td><td class="bar" id="b9"><img src="../.resources/greenbar.gif" width="3" height=" 10" title="37" alt="37"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d9"/><td class="ctr2" id="e9">n/a</td><td class="ctr1" id="f9">0</td><td class="ctr2" id="g11">2</td><td class="ctr1" id="h9">0</td><td class="ctr2" id="i9">4</td><td class="ctr1" id="j9">0</td><td class="ctr2" id="k11">2</td><td class="ctr1" id="l9">0</td><td class="ctr2" id="m9">1</td></tr><tr><td id="a2"><a href="BigFractionField.html" class="el_class">BigFractionField</a></td><td class="bar" id="b10"><img src="../.resources/greenbar.gif" width="1" height="10" title="13" alt="13"/></td><td class="ctr2" id="c1">100%</td><td class="bar" id="d10"/><td class="ctr2" id="e10">n/a</td><td class="ctr1" id="f10">0</td><td class="ctr2" id="g7">6</td><td class="ctr1" id="h10">0</td><td class="ctr2" id="i7">7</td><td class="ctr1" id="j10">0</td><td class="ctr2" id="k7">6</td><td class="ctr1" id="l10">0</td><td class="ctr2" id="m10">1</td></tr><tr><td id="a7"><a href="FractionField.html" class="el_class">Fract ionField</a></td><td class="bar" id="b11"><img src="../.resources/greenbar.gif" width="1" height="10" title="13" alt="13"/></td><td class="ctr2" id="c2">100%</td><td class="bar" id="d11"/><td class="ctr2" id="e11">n/a</td><td class="ctr1" id="f11">0</td><td class="ctr2" id="g8">6</td><td class="ctr1" id="h11">0</td><td class="ctr2" id="i8">7</td><td class="ctr1" id="j11">0</td><td class="ctr2" id="k8">6</td><td class="ctr1" id="l11">0</td><td class="ctr2" id="m11">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.5.201505241946</span></div></body></html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/commons-complex/blob/b3576eeb/site-content/.svn/pristine/06/060fb1b04e9614e32ac41c30b407244cfe1f444e.svn-base ---------------------------------------------------------------------- diff --git a/site-content/.svn/pristine/06/060fb1b04e9614e32ac41c30b407244cfe1f444e.svn-base b/site-content/.svn/pristine/06/060fb1b04e9614e32ac41c30b407244cfe1f444e.svn-base deleted file mode 100644 index 69ba121..0000000 --- a/site-content/.svn/pristine/06/060fb1b04e9614e32ac41c30b407244cfe1f444e.svn-base +++ /dev/null @@ -1,260 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html lang="en"> -<head> -<title>Source code</title> -<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> -</head> -<body> -<div class="sourceContainer"> -<pre><span class="sourceLineNo">001</span>/*<a name="line.1"></a> -<span class="sourceLineNo">002</span> * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a> -<span class="sourceLineNo">003</span> * contributor license agreements. See the NOTICE file distributed with<a name="line.3"></a> -<span class="sourceLineNo">004</span> * this work for additional information regarding copyright ownership.<a name="line.4"></a> -<span class="sourceLineNo">005</span> * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a> -<span class="sourceLineNo">006</span> * (the "License"); you may not use this file except in compliance with<a name="line.6"></a> -<span class="sourceLineNo">007</span> * the License. You may obtain a copy of the License at<a name="line.7"></a> -<span class="sourceLineNo">008</span> *<a name="line.8"></a> -<span class="sourceLineNo">009</span> * http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a> -<span class="sourceLineNo">010</span> *<a name="line.10"></a> -<span class="sourceLineNo">011</span> * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a> -<span class="sourceLineNo">012</span> * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a> -<span class="sourceLineNo">013</span> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a> -<span class="sourceLineNo">014</span> * See the License for the specific language governing permissions and<a name="line.14"></a> -<span class="sourceLineNo">015</span> * limitations under the License.<a name="line.15"></a> -<span class="sourceLineNo">016</span> */<a name="line.16"></a> -<span class="sourceLineNo">017</span><a name="line.17"></a> -<span class="sourceLineNo">018</span>package org.apache.commons.math3.ode;<a name="line.18"></a> -<span class="sourceLineNo">019</span><a name="line.19"></a> -<span class="sourceLineNo">020</span>import org.apache.commons.math3.ode.FirstOrderDifferentialEquations;<a name="line.20"></a> -<span class="sourceLineNo">021</span>import org.apache.commons.math3.ode.events.EventHandler;<a name="line.21"></a> -<span class="sourceLineNo">022</span><a name="line.22"></a> -<span class="sourceLineNo">023</span>/**<a name="line.23"></a> -<span class="sourceLineNo">024</span> * This class is used as the base class of the problems that are<a name="line.24"></a> -<span class="sourceLineNo">025</span> * integrated during the junit tests for the ODE integrators.<a name="line.25"></a> -<span class="sourceLineNo">026</span> */<a name="line.26"></a> -<span class="sourceLineNo">027</span>public abstract class TestProblemAbstract<a name="line.27"></a> -<span class="sourceLineNo">028</span> implements FirstOrderDifferentialEquations {<a name="line.28"></a> -<span class="sourceLineNo">029</span><a name="line.29"></a> -<span class="sourceLineNo">030</span> /** Dimension of the problem. */<a name="line.30"></a> -<span class="sourceLineNo">031</span> protected int n;<a name="line.31"></a> -<span class="sourceLineNo">032</span><a name="line.32"></a> -<span class="sourceLineNo">033</span> /** Number of functions calls. */<a name="line.33"></a> -<span class="sourceLineNo">034</span> protected int calls;<a name="line.34"></a> -<span class="sourceLineNo">035</span><a name="line.35"></a> -<span class="sourceLineNo">036</span> /** Initial time */<a name="line.36"></a> -<span class="sourceLineNo">037</span> protected double t0;<a name="line.37"></a> -<span class="sourceLineNo">038</span><a name="line.38"></a> -<span class="sourceLineNo">039</span> /** Initial state */<a name="line.39"></a> -<span class="sourceLineNo">040</span> protected double[] y0;<a name="line.40"></a> -<span class="sourceLineNo">041</span><a name="line.41"></a> -<span class="sourceLineNo">042</span> /** Final time */<a name="line.42"></a> -<span class="sourceLineNo">043</span> protected double t1;<a name="line.43"></a> -<span class="sourceLineNo">044</span><a name="line.44"></a> -<span class="sourceLineNo">045</span> /** Error scale */<a name="line.45"></a> -<span class="sourceLineNo">046</span> protected double[] errorScale;<a name="line.46"></a> -<span class="sourceLineNo">047</span><a name="line.47"></a> -<span class="sourceLineNo">048</span> /**<a name="line.48"></a> -<span class="sourceLineNo">049</span> * Simple constructor.<a name="line.49"></a> -<span class="sourceLineNo">050</span> */<a name="line.50"></a> -<span class="sourceLineNo">051</span> protected TestProblemAbstract() {<a name="line.51"></a> -<span class="sourceLineNo">052</span> n = 0;<a name="line.52"></a> -<span class="sourceLineNo">053</span> calls = 0;<a name="line.53"></a> -<span class="sourceLineNo">054</span> t0 = 0;<a name="line.54"></a> -<span class="sourceLineNo">055</span> y0 = null;<a name="line.55"></a> -<span class="sourceLineNo">056</span> t1 = 0;<a name="line.56"></a> -<span class="sourceLineNo">057</span> errorScale = null;<a name="line.57"></a> -<span class="sourceLineNo">058</span> }<a name="line.58"></a> -<span class="sourceLineNo">059</span><a name="line.59"></a> -<span class="sourceLineNo">060</span> /**<a name="line.60"></a> -<span class="sourceLineNo">061</span> * Copy constructor.<a name="line.61"></a> -<span class="sourceLineNo">062</span> * @param problem problem to copy<a name="line.62"></a> -<span class="sourceLineNo">063</span> */<a name="line.63"></a> -<span class="sourceLineNo">064</span> protected TestProblemAbstract(TestProblemAbstract problem) {<a name="line.64"></a> -<span class="sourceLineNo">065</span> n = problem.n;<a name="line.65"></a> -<span class="sourceLineNo">066</span> calls = problem.calls;<a name="line.66"></a> -<span class="sourceLineNo">067</span> t0 = problem.t0;<a name="line.67"></a> -<span class="sourceLineNo">068</span> if (problem.y0 == null) {<a name="line.68"></a> -<span class="sourceLineNo">069</span> y0 = null;<a name="line.69"></a> -<span class="sourceLineNo">070</span> } else {<a name="line.70"></a> -<span class="sourceLineNo">071</span> y0 = problem.y0.clone();<a name="line.71"></a> -<span class="sourceLineNo">072</span> }<a name="line.72"></a> -<span class="sourceLineNo">073</span> if (problem.errorScale == null) {<a name="line.73"></a> -<span class="sourceLineNo">074</span> errorScale = null;<a name="line.74"></a> -<span class="sourceLineNo">075</span> } else {<a name="line.75"></a> -<span class="sourceLineNo">076</span> errorScale = problem.errorScale.clone();<a name="line.76"></a> -<span class="sourceLineNo">077</span> }<a name="line.77"></a> -<span class="sourceLineNo">078</span> t1 = problem.t1;<a name="line.78"></a> -<span class="sourceLineNo">079</span> }<a name="line.79"></a> -<span class="sourceLineNo">080</span><a name="line.80"></a> -<span class="sourceLineNo">081</span> /**<a name="line.81"></a> -<span class="sourceLineNo">082</span> * Copy operation.<a name="line.82"></a> -<span class="sourceLineNo">083</span> * @return a copy of the instance<a name="line.83"></a> -<span class="sourceLineNo">084</span> */<a name="line.84"></a> -<span class="sourceLineNo">085</span> public abstract TestProblemAbstract copy();<a name="line.85"></a> -<span class="sourceLineNo">086</span><a name="line.86"></a> -<span class="sourceLineNo">087</span> /**<a name="line.87"></a> -<span class="sourceLineNo">088</span> * Set the initial conditions<a name="line.88"></a> -<span class="sourceLineNo">089</span> * @param t0 initial time<a name="line.89"></a> -<span class="sourceLineNo">090</span> * @param y0 initial state vector<a name="line.90"></a> -<span class="sourceLineNo">091</span> */<a name="line.91"></a> -<span class="sourceLineNo">092</span> protected void setInitialConditions(double t0, double[] y0) {<a name="line.92"></a> -<span class="sourceLineNo">093</span> calls = 0;<a name="line.93"></a> -<span class="sourceLineNo">094</span> n = y0.length;<a name="line.94"></a> -<span class="sourceLineNo">095</span> this.t0 = t0;<a name="line.95"></a> -<span class="sourceLineNo">096</span> this.y0 = y0.clone();<a name="line.96"></a> -<span class="sourceLineNo">097</span> }<a name="line.97"></a> -<span class="sourceLineNo">098</span><a name="line.98"></a> -<span class="sourceLineNo">099</span> /**<a name="line.99"></a> -<span class="sourceLineNo">100</span> * Set the final conditions.<a name="line.100"></a> -<span class="sourceLineNo">101</span> * @param t1 final time<a name="line.101"></a> -<span class="sourceLineNo">102</span> */<a name="line.102"></a> -<span class="sourceLineNo">103</span> protected void setFinalConditions(double t1) {<a name="line.103"></a> -<span class="sourceLineNo">104</span> this.t1 = t1;<a name="line.104"></a> -<span class="sourceLineNo">105</span> }<a name="line.105"></a> -<span class="sourceLineNo">106</span><a name="line.106"></a> -<span class="sourceLineNo">107</span> /**<a name="line.107"></a> -<span class="sourceLineNo">108</span> * Set the error scale<a name="line.108"></a> -<span class="sourceLineNo">109</span> * @param errorScale error scale<a name="line.109"></a> -<span class="sourceLineNo">110</span> */<a name="line.110"></a> -<span class="sourceLineNo">111</span> protected void setErrorScale(double[] errorScale) {<a name="line.111"></a> -<span class="sourceLineNo">112</span> this.errorScale = errorScale.clone();<a name="line.112"></a> -<span class="sourceLineNo">113</span> }<a name="line.113"></a> -<span class="sourceLineNo">114</span><a name="line.114"></a> -<span class="sourceLineNo">115</span> public int getDimension() {<a name="line.115"></a> -<span class="sourceLineNo">116</span> return n;<a name="line.116"></a> -<span class="sourceLineNo">117</span> }<a name="line.117"></a> -<span class="sourceLineNo">118</span><a name="line.118"></a> -<span class="sourceLineNo">119</span> /**<a name="line.119"></a> -<span class="sourceLineNo">120</span> * Get the initial time.<a name="line.120"></a> -<span class="sourceLineNo">121</span> * @return initial time<a name="line.121"></a> -<span class="sourceLineNo">122</span> */<a name="line.122"></a> -<span class="sourceLineNo">123</span> public double getInitialTime() {<a name="line.123"></a> -<span class="sourceLineNo">124</span> return t0;<a name="line.124"></a> -<span class="sourceLineNo">125</span> }<a name="line.125"></a> -<span class="sourceLineNo">126</span><a name="line.126"></a> -<span class="sourceLineNo">127</span> /**<a name="line.127"></a> -<span class="sourceLineNo">128</span> * Get the initial state vector.<a name="line.128"></a> -<span class="sourceLineNo">129</span> * @return initial state vector<a name="line.129"></a> -<span class="sourceLineNo">130</span> */<a name="line.130"></a> -<span class="sourceLineNo">131</span> public double[] getInitialState() {<a name="line.131"></a> -<span class="sourceLineNo">132</span> return y0;<a name="line.132"></a> -<span class="sourceLineNo">133</span> }<a name="line.133"></a> -<span class="sourceLineNo">134</span><a name="line.134"></a> -<span class="sourceLineNo">135</span> /**<a name="line.135"></a> -<span class="sourceLineNo">136</span> * Get the final time.<a name="line.136"></a> -<span class="sourceLineNo">137</span> * @return final time<a name="line.137"></a> -<span class="sourceLineNo">138</span> */<a name="line.138"></a> -<span class="sourceLineNo">139</span> public double getFinalTime() {<a name="line.139"></a> -<span class="sourceLineNo">140</span> return t1;<a name="line.140"></a> -<span class="sourceLineNo">141</span> }<a name="line.141"></a> -<span class="sourceLineNo">142</span><a name="line.142"></a> -<span class="sourceLineNo">143</span> /**<a name="line.143"></a> -<span class="sourceLineNo">144</span> * Get the error scale.<a name="line.144"></a> -<span class="sourceLineNo">145</span> * @return error scale<a name="line.145"></a> -<span class="sourceLineNo">146</span> */<a name="line.146"></a> -<span class="sourceLineNo">147</span> public double[] getErrorScale() {<a name="line.147"></a> -<span class="sourceLineNo">148</span> return errorScale;<a name="line.148"></a> -<span class="sourceLineNo">149</span> }<a name="line.149"></a> -<span class="sourceLineNo">150</span><a name="line.150"></a> -<span class="sourceLineNo">151</span> /**<a name="line.151"></a> -<span class="sourceLineNo">152</span> * Get the events handlers.<a name="line.152"></a> -<span class="sourceLineNo">153</span> * @return events handlers */<a name="line.153"></a> -<span class="sourceLineNo">154</span> public EventHandler[] getEventsHandlers() {<a name="line.154"></a> -<span class="sourceLineNo">155</span> return new EventHandler[0];<a name="line.155"></a> -<span class="sourceLineNo">156</span> }<a name="line.156"></a> -<span class="sourceLineNo">157</span><a name="line.157"></a> -<span class="sourceLineNo">158</span> /**<a name="line.158"></a> -<span class="sourceLineNo">159</span> * Get the theoretical events times.<a name="line.159"></a> -<span class="sourceLineNo">160</span> * @return theoretical events times<a name="line.160"></a> -<span class="sourceLineNo">161</span> */<a name="line.161"></a> -<span class="sourceLineNo">162</span> public double[] getTheoreticalEventsTimes() {<a name="line.162"></a> -<span class="sourceLineNo">163</span> return new double[0];<a name="line.163"></a> -<span class="sourceLineNo">164</span> }<a name="line.164"></a> -<span class="sourceLineNo">165</span><a name="line.165"></a> -<span class="sourceLineNo">166</span> /**<a name="line.166"></a> -<span class="sourceLineNo">167</span> * Get the number of calls.<a name="line.167"></a> -<span class="sourceLineNo">168</span> * @return nuber of calls<a name="line.168"></a> -<span class="sourceLineNo">169</span> */<a name="line.169"></a> -<span class="sourceLineNo">170</span> public int getCalls() {<a name="line.170"></a> -<span class="sourceLineNo">171</span> return calls;<a name="line.171"></a> -<span class="sourceLineNo">172</span> }<a name="line.172"></a> -<span class="sourceLineNo">173</span><a name="line.173"></a> -<span class="sourceLineNo">174</span> public void computeDerivatives(double t, double[] y, double[] yDot) {<a name="line.174"></a> -<span class="sourceLineNo">175</span> ++calls;<a name="line.175"></a> -<span class="sourceLineNo">176</span> doComputeDerivatives(t, y, yDot);<a name="line.176"></a> -<span class="sourceLineNo">177</span> }<a name="line.177"></a> -<span class="sourceLineNo">178</span><a name="line.178"></a> -<span class="sourceLineNo">179</span> abstract public void doComputeDerivatives(double t, double[] y, double[] yDot);<a name="line.179"></a> -<span class="sourceLineNo">180</span><a name="line.180"></a> -<span class="sourceLineNo">181</span> /**<a name="line.181"></a> -<span class="sourceLineNo">182</span> * Compute the theoretical state at the specified time.<a name="line.182"></a> -<span class="sourceLineNo">183</span> * @param t time at which the state is required<a name="line.183"></a> -<span class="sourceLineNo">184</span> * @return state vector at time t<a name="line.184"></a> -<span class="sourceLineNo">185</span> */<a name="line.185"></a> -<span class="sourceLineNo">186</span> abstract public double[] computeTheoreticalState(double t);<a name="line.186"></a> -<span class="sourceLineNo">187</span><a name="line.187"></a> -<span class="sourceLineNo">188</span>}<a name="line.188"></a> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</pre> -</div> -</body> -</html>
