You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2018/02/22 12:27:51 UTC
[01/10] commons-rng git commit: Javadoc.
Repository: commons-rng
Updated Branches:
refs/heads/master fe32c6dff -> 32ed8c659
Javadoc.
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/0cd1df06
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/0cd1df06
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/0cd1df06
Branch: refs/heads/master
Commit: 0cd1df0621790be0ca8e2905d4c4a063317da1cb
Parents: fe32c6d
Author: Gilles <er...@apache.org>
Authored: Thu Feb 22 11:43:06 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Thu Feb 22 11:43:06 2018 +0100
----------------------------------------------------------------------
.../main/java/org/apache/commons/rng/UniformRandomProvider.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/0cd1df06/commons-rng-client-api/src/main/java/org/apache/commons/rng/UniformRandomProvider.java
----------------------------------------------------------------------
diff --git a/commons-rng-client-api/src/main/java/org/apache/commons/rng/UniformRandomProvider.java b/commons-rng-client-api/src/main/java/org/apache/commons/rng/UniformRandomProvider.java
index 2b974ad..07d3108 100644
--- a/commons-rng-client-api/src/main/java/org/apache/commons/rng/UniformRandomProvider.java
+++ b/commons-rng-client-api/src/main/java/org/apache/commons/rng/UniformRandomProvider.java
@@ -69,7 +69,7 @@ public interface UniformRandomProvider {
* specified value (exclusive).
*
* @param n Bound on the random number to be returned. Must be positive.
- * @return a random {@code int} value between 0 (inclusive) and n
+ * @return a random {@code int} value between 0 (inclusive) and {@code n}
* (exclusive).
* @throws IllegalArgumentException if {@code n} is negative.
*/
@@ -87,7 +87,7 @@ public interface UniformRandomProvider {
* value (exclusive).
*
* @param n Bound on the random number to be returned. Must be positive.
- * @return a random {@code long} value between 0 (inclusive) and n
+ * @return a random {@code long} value between 0 (inclusive) and {@code n}
* (exclusive).
* @throws IllegalArgumentException if {@code n} is negative.
*/
[02/10] commons-rng git commit: Make assumption more prominent.
Posted by er...@apache.org.
Make assumption more prominent.
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/5f579ffc
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/5f579ffc
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/5f579ffc
Branch: refs/heads/master
Commit: 5f579ffc97e9450c0b9c62a9f1e455b34ad11d51
Parents: 0cd1df0
Author: Gilles <er...@apache.org>
Authored: Thu Feb 22 11:45:53 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Thu Feb 22 11:45:53 2018 +0100
----------------------------------------------------------------------
.../org/apache/commons/rng/core/source32/AbstractWell.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/5f579ffc/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractWell.java
----------------------------------------------------------------------
diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractWell.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractWell.java
index d72a342..b181f30 100644
--- a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractWell.java
+++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractWell.java
@@ -38,6 +38,8 @@ import org.apache.commons.rng.core.util.NumberFactory;
* @since 1.0
*/
public abstract class AbstractWell extends IntProvider {
+ /** Block size. */
+ private static final int BLOCK_SIZE = 32;
/** Current index in the bytes pool. */
protected int index;
/** Bytes pool. */
@@ -103,11 +105,10 @@ public abstract class AbstractWell extends IntProvider {
* @return the number of 32-bits blocks.
*/
private static int calculateBlockCount(final int k) {
- // the bits pool contains k bits, k = r w - p where r is the number
+ // The bits pool contains k bits, k = r w - p where r is the number
// of w bits blocks, w is the block size (always 32 in the original paper)
- // and p is the number of unused bits in the last block
- final int w = 32;
- return (k + w - 1) / w;
+ // and p is the number of unused bits in the last block.
+ return (k + BLOCK_SIZE - 1) / BLOCK_SIZE;
}
/**
[06/10] commons-rng git commit: Userguide.
Posted by er...@apache.org.
Userguide.
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/79db12a7
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/79db12a7
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/79db12a7
Branch: refs/heads/master
Commit: 79db12a7dc9a3eff410a6735478b2a3a8761b737
Parents: 4b34e77
Author: Gilles <er...@apache.org>
Authored: Thu Feb 22 11:59:03 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Thu Feb 22 11:59:03 2018 +0100
----------------------------------------------------------------------
src/site/apt/userguide/rng.apt | 65 ++++++++++++++++++++++++++++++++-----
1 file changed, 57 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/79db12a7/src/site/apt/userguide/rng.apt
----------------------------------------------------------------------
diff --git a/src/site/apt/userguide/rng.apt b/src/site/apt/userguide/rng.apt
index 989c69c..0c3b865 100644
--- a/src/site/apt/userguide/rng.apt
+++ b/src/site/apt/userguide/rng.apt
@@ -40,17 +40,66 @@
The library is divided into modules:
- * {{{../commons-rng-client-api/apidocs/org/apache/commons/rng/package-summary.html}Client API}}
+ * {{{../commons-rng-client-api/apidocs/org/apache/commons/rng/package-summary.html}Client API}} (requires Java 6)
- * {{{../commons-rng-core/apidocs/org/apache/commons/rng/core/package-summary.html}Core}}
+ This module provides the
+ {{{../commons-rng-client-api/apidocs/org/apache/commons/rng/RestorableUniformRandomProvider.html}interface}}
+ to be passed as argument to a procedure that needs to access to a sequence of random numbers.
- * {{{../commons-rng-simple/apidocs/org/apache/commons/rng/simple/package-summary.html}Simple}}
+ * {{{../commons-rng-core/apidocs/org/apache/commons/rng/core/package-summary.html}Core}} (requires Java 6)
- * {{{../commons-rng-sampling/apidocs/org/apache/commons/rng/sampling/package-summary.html}Sampling}}
+ This module contains the implementations of several generators of pseudo-random sequences of numbers.
+ Code in this module is intended to be internal to this library and no user code should access it
+ directly.
+ With the advent of {{{http://openjdk.java.net/projects/jigsaw/}Java modularization}}, it is possible
+ that future releases of the library will enforce access through the
+ {{{../commons-rng-simple/apidocs/org/apache/commons/rng/simple/RandomSource.html}RandomSource}}
+ factory.
- * {{{../commons-rng-jmh/apidocs/org/apache/commons/rng/jmh/package-summary.html}Benchmark}}
+ * {{{../commons-rng-simple/apidocs/org/apache/commons/rng/simple/package-summary.html}Simple}} (requires Java 6)
- * {{{../commons-rng-examples/apidocs/org/apache/commons/rng/examples/package-summary.html}Examples}}
+ This module provides factory methods for creating instances of all the generators implemented
+ in the <<<commons-rng-core>>> module.
+
+ * {{{../commons-rng-sampling/apidocs/org/apache/commons/rng/sampling/package-summary.html}Sampling}} (requires Java 6)
+
+ This module provides implementations that generate a sequence of numbers according to some
+ specified probability distribution, and utilities to sample from a generic collection of items.
+ It is an example of usage of the API provided in the <<<commons-rng-client-api>>> module.
+
+ * Examples
+
+ This module provides miscellaneous complete applications that illustrate usage of the library.
+ Please note that this module is not part of the library's API; no compatibility should be expected
+ in successive releases of "Commons RNG".
+
+ As of version 1.1, the following modules are provided:
+
+ ** <<<examples-jmh>>>: JMH benchmarking (requires Java 8)
+
+ This module uses the {{{http://openjdk.java.net/projects/code-tools/jmh/}JMH micro-benchmark framework}}
+ in order to assess the relative performance of the generators (see tables below).
+
+ ** <<<examples-stress>>>: Stress testing (requires Java 8)
+
+ This module implements a wrapper that calls external tools that can assess the quality of
+ the generators by submitting their output to a battery of "stress tests" (see tables below).
+
+ ** <<<examples-sampling>>>: Probability density (requires Java 8)
+
+ This module contains the code that generates the data used to produce the probability density
+ plots shown in {{{./dist_density_approx.html}this userguide}}.
+
+ ** <<<examples-jpms>>>: JPMS integration (requires Java 9)
+
+ This module implements a dummy application that shows how to use the artefacts (produced
+ from the maven modules described above) as Java modules ({{{https://en.wikipedia.org/wiki/Java_Platform_Module_System}JPMS}}).
+
+ ** <<<examples-quadrature>>>: Quadrature (requires Java 8)
+
+ This module contains an application that estimates the number 𝞹 using quasi-Montecarlo integration.
+
+ []
[]
@@ -98,12 +147,12 @@ double x = rng.nextDouble(); // 0 <= x < 1.
* A generator will fill a given <<<byte>>> array with random values.
+--------------------------+
-bytes[] a = new bytes[47];
+byte[] a = new byte[47];
// The elements of "a" are replaced with random values from the interval [-128, 127].
rng.nextBytes(a);
+--------------------------+
+--------------------------+
-bytes[] a = new bytes[47];
+byte[] a = new byte[47];
// Replace 3 elements of the array (at indices 15, 16 and 17) with random values.
rng.nextBytes(a, 15, 3);
+--------------------------+
[04/10] commons-rng git commit: Use "foreach" loop.
Posted by er...@apache.org.
Use "foreach" loop.
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/a787e051
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/a787e051
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/a787e051
Branch: refs/heads/master
Commit: a787e0513c3befaf353521cea3d92d95ef595b76
Parents: f8814d0
Author: Gilles <er...@apache.org>
Authored: Thu Feb 22 11:54:00 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Thu Feb 22 11:54:00 2018 +0100
----------------------------------------------------------------------
.../org/apache/commons/rng/simple/internal/IntArray2Int.java | 4 ++--
.../org/apache/commons/rng/simple/internal/LongArray2Long.java | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/a787e051/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/IntArray2Int.java
----------------------------------------------------------------------
diff --git a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/IntArray2Int.java b/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/IntArray2Int.java
index 6e9733d..1befeef 100644
--- a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/IntArray2Int.java
+++ b/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/IntArray2Int.java
@@ -26,8 +26,8 @@ public class IntArray2Int implements SeedConverter<int[], Integer> {
@Override
public Integer convert(int[] seed) {
int out = 0;
- for (int i = 0; i < seed.length; i++) {
- out ^= seed[i];
+ for (int s : seed) {
+ out ^= s;
}
return out;
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/a787e051/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/LongArray2Long.java
----------------------------------------------------------------------
diff --git a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/LongArray2Long.java b/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/LongArray2Long.java
index d169b7c..f683d77 100644
--- a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/LongArray2Long.java
+++ b/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/LongArray2Long.java
@@ -26,8 +26,8 @@ public class LongArray2Long implements SeedConverter<long[], Long> {
@Override
public Long convert(long[] seed) {
long out = 0;
- for (int i = 0; i < seed.length; i++) {
- out ^= seed[i];
+ for (long s : seed) {
+ out ^= s;
}
return out;
[09/10] commons-rng git commit: PMD.
Posted by er...@apache.org.
PMD.
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/9cc27a5a
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/9cc27a5a
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/9cc27a5a
Branch: refs/heads/master
Commit: 9cc27a5a89e34de8b23b58241adbedb15f50abee
Parents: 1421751
Author: Gilles <er...@apache.org>
Authored: Thu Feb 22 13:25:30 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Thu Feb 22 13:25:30 2018 +0100
----------------------------------------------------------------------
.../commons/rng/simple/internal/ProviderBuilder.java | 14 +++++++-------
.../commons/rng/simple/internal/SeedFactory.java | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/9cc27a5a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/ProviderBuilder.java
----------------------------------------------------------------------
diff --git a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/ProviderBuilder.java b/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/ProviderBuilder.java
index 38097d8..cf82d95 100644
--- a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/ProviderBuilder.java
+++ b/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/ProviderBuilder.java
@@ -20,7 +20,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
-import java.util.HashMap;
+import java.util.concurrent.ConcurrentHashMap;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
@@ -49,7 +49,7 @@ import org.apache.commons.rng.core.source64.MersenneTwister64;
* and performs seed type conversions.
* </p>
*/
-public class ProviderBuilder {
+public final class ProviderBuilder {
/** Error message. */
private static final String INTERNAL_ERROR_MSG = "Internal error: Please file a bug report";
/** Length of the seed array (for random seed). */
@@ -76,19 +76,19 @@ public class ProviderBuilder {
private static final ByteArray2LongArray BYTE_ARRAY_TO_LONG_ARRAY = new ByteArray2LongArray();
/** Map to convert "Integer" seeds. */
private static final Map<Class<?>, SeedConverter<Integer,?>> CONV_INT =
- new HashMap<Class<?>, SeedConverter<Integer,?>>();
+ new ConcurrentHashMap<Class<?>, SeedConverter<Integer,?>>();
/** Map to convert "int[]" seeds. */
private static final Map<Class<?>, SeedConverter<int[],?>> CONV_INT_ARRAY =
- new HashMap<Class<?>, SeedConverter<int[],?>>();
+ new ConcurrentHashMap<Class<?>, SeedConverter<int[],?>>();
/** Map to convert "Long" seeds. */
private static final Map<Class<?>, SeedConverter<Long,?>> CONV_LONG =
- new HashMap<Class<?>, SeedConverter<Long,?>>();
+ new ConcurrentHashMap<Class<?>, SeedConverter<Long,?>>();
/** Map to convert "long[]" seeds. */
private static final Map<Class<?>, SeedConverter<long[],?>> CONV_LONG_ARRAY =
- new HashMap<Class<?>, SeedConverter<long[],?>>();
+ new ConcurrentHashMap<Class<?>, SeedConverter<long[],?>>();
/** Map to convert "byte[]" seeds. */
private static final Map<Class<?>, SeedConverter<byte[],?>> CONV_BYTE_ARRAY =
- new HashMap<Class<?>, SeedConverter<byte[],?>>();
+ new ConcurrentHashMap<Class<?>, SeedConverter<byte[],?>>();
static {
// Input seed type is "Long".
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/9cc27a5a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/SeedFactory.java
----------------------------------------------------------------------
diff --git a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/SeedFactory.java b/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/SeedFactory.java
index e94df80..0b7f51f 100644
--- a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/SeedFactory.java
+++ b/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/SeedFactory.java
@@ -41,7 +41,7 @@ import org.apache.commons.rng.core.source64.SplitMix64;
*
* @since 1.0
*/
-public class SeedFactory {
+public final class SeedFactory {
/** Generator with a long period. */
private static final RandomIntSource SEED_GENERATOR;
[03/10] commons-rng git commit: Use field for constant.
Posted by er...@apache.org.
Use field for constant.
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/f8814d02
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/f8814d02
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/f8814d02
Branch: refs/heads/master
Commit: f8814d02c3388eeab1ce0453172b26a4f0607df7
Parents: 5f579ff
Author: Gilles <er...@apache.org>
Authored: Thu Feb 22 11:52:01 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Thu Feb 22 11:52:01 2018 +0100
----------------------------------------------------------------------
.../org/apache/commons/rng/core/source64/TwoCmres.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/f8814d02/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/TwoCmres.java
----------------------------------------------------------------------
diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/TwoCmres.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/TwoCmres.java
index ce95264..b542d0b 100644
--- a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/TwoCmres.java
+++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/TwoCmres.java
@@ -168,6 +168,10 @@ public class TwoCmres extends LongProvider {
* Class is immutable.
*/
static class Cmres {
+ /** Separator. */
+ private static final String SEP = ", ";
+ /** Hexadecimal format. */
+ private static final String HEX_FORMAT = "0x%016xL";
/** Cycle start. */
private final int start;
/** Multiplier. */
@@ -191,10 +195,8 @@ public class TwoCmres extends LongProvider {
/** {@inheritDoc} */
@Override
public String toString() {
- final String sep = ", ";
- // Use hexadecimal for "multiplier" field.
- final String m = String.format((java.util.Locale) null, "0x%016xL", multiply);
- return "Cmres: [" + m + sep + rotate + sep + start + "]";
+ final String m = String.format((java.util.Locale) null, HEX_FORMAT, multiply);
+ return "Cmres: [" + m + SEP + rotate + SEP + start + "]";
}
/**
[05/10] commons-rng git commit: Use "final" for constant fields.
Posted by er...@apache.org.
Use "final" for constant fields.
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/4b34e779
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/4b34e779
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/4b34e779
Branch: refs/heads/master
Commit: 4b34e779c1e721a56b39b1969ff84ce4a713aa6a
Parents: a787e05
Author: Gilles <er...@apache.org>
Authored: Thu Feb 22 11:54:41 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Thu Feb 22 11:54:41 2018 +0100
----------------------------------------------------------------------
.../commons/rng/simple/internal/SeedConverterComposer.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/4b34e779/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/SeedConverterComposer.java
----------------------------------------------------------------------
diff --git a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/SeedConverterComposer.java b/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/SeedConverterComposer.java
index 557c789..4125a28 100644
--- a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/SeedConverterComposer.java
+++ b/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/SeedConverterComposer.java
@@ -27,9 +27,9 @@ package org.apache.commons.rng.simple.internal;
*/
public class SeedConverterComposer<IN, TRANS, OUT> implements SeedConverter<IN, OUT> {
/** First conversion. */
- private SeedConverter<IN, TRANS> first;
+ private final SeedConverter<IN, TRANS> first;
/** Second conversion. */
- private SeedConverter<TRANS, OUT> second;
+ private final SeedConverter<TRANS, OUT> second;
/**
* @param first First conversion.
[10/10] commons-rng git commit: PMD.
Posted by er...@apache.org.
PMD.
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/32ed8c65
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/32ed8c65
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/32ed8c65
Branch: refs/heads/master
Commit: 32ed8c65941ec9f23c75c2dc6edea850c1b61477
Parents: 9cc27a5
Author: Gilles <er...@apache.org>
Authored: Thu Feb 22 13:26:48 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Thu Feb 22 13:26:48 2018 +0100
----------------------------------------------------------------------
.../java/org/apache/commons/rng/core/source32/JDKRandom.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/32ed8c65/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/JDKRandom.java
----------------------------------------------------------------------
diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/JDKRandom.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/JDKRandom.java
index fe9b404..1312814 100644
--- a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/JDKRandom.java
+++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/JDKRandom.java
@@ -75,7 +75,7 @@ public class JDKRandom extends IntProvider {
return bos.toByteArray();
} catch (IOException e) {
// Workaround checked exception.
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
@@ -89,10 +89,10 @@ public class JDKRandom extends IntProvider {
delegate = (Random) ois.readObject();
} catch (ClassNotFoundException e) {
// Workaround checked exception.
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
} catch (IOException e) {
// Workaround checked exception.
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
}
[07/10] commons-rng git commit: Update PMD config.
Posted by er...@apache.org.
Update PMD config.
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/b01d0d1d
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/b01d0d1d
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/b01d0d1d
Branch: refs/heads/master
Commit: b01d0d1d4ce5b766172b1d7375a4319295e3ce45
Parents: 79db12a
Author: Gilles <er...@apache.org>
Authored: Thu Feb 22 12:00:21 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Thu Feb 22 12:00:21 2018 +0100
----------------------------------------------------------------------
pom.xml | 1 +
src/main/resources/pmd/pmd-ruleset.xml | 56 +++++++++++++++--------------
2 files changed, 30 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/b01d0d1d/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 96b222a..421434f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -361,6 +361,7 @@
<configuration>
<targetJdk>${maven.compiler.target}</targetJdk>
<skipEmptyReport>false</skipEmptyReport>
+ <analysisCache>true</analysisCache>
<rulesets>
<ruleset>${rng.parent.dir}/src/main/resources/pmd/pmd-ruleset.xml</ruleset>
</rulesets>
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/b01d0d1d/src/main/resources/pmd/pmd-ruleset.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/pmd/pmd-ruleset.xml b/src/main/resources/pmd/pmd-ruleset.xml
index c637ef7..0db1c6e 100644
--- a/src/main/resources/pmd/pmd-ruleset.xml
+++ b/src/main/resources/pmd/pmd-ruleset.xml
@@ -23,35 +23,37 @@
This ruleset checks the code for discouraged programming constructs.
</description>
- <rule ref="rulesets/java/basic.xml"/>
-
- <rule ref="rulesets/java/braces.xml"/>
-
- <rule ref="rulesets/java/comments.xml">
- <exclude name="CommentSize"/>
+ <rule ref="category/java/bestpractices.xml">
+ <exclude name="UseVarargs" />
</rule>
- <rule ref="rulesets/java/comments.xml/CommentSize">
- <properties>
- <property name="maxLines" value="200"/>
- <property name="maxLineLength" value="256"/>
- </properties>
+ <rule ref="category/java/codestyle.xml">
+ <exclude name="MethodArgumentCouldBeFinal" />
+ <exclude name="ShortVariable" />
+ <exclude name="LongVariable" />
+ <exclude name="CommentDefaultAccessModifier" />
+ <exclude name="DefaultPackage" />
+ <exclude name="CallSuperInConstructor" />
+ <exclude name="AbstractNaming" />
+ <exclude name="UselessParentheses" />
+ <exclude name="AtLeastOneConstructor" />
+ <exclude name="GenericsNaming" />
</rule>
-
- <rule ref="rulesets/java/empty.xml"/>
-
- <rule ref="rulesets/java/finalizers.xml"/>
-
- <rule ref="rulesets/java/imports.xml"/>
-
- <rule ref="rulesets/java/typeresolution.xml"/>
-
- <rule ref="rulesets/java/clone.xml"/>
-
- <rule ref="rulesets/java/unnecessary.xml">
- <!-- We do use extra parentheses there as most people do not recall operator precedence,
- this means even if the parentheses are useless for the compiler, we don't consider
- them useless for the developer. This is the reason why we disable this rule. -->
- <exclude name="UselessParentheses"/>
+ <rule ref="category/java/design.xml">
+ <exclude name="TooManyMethods" />
+ <exclude name="LawOfDemeter" />
+ <exclude name="NcssCount" />
+ </rule>
+ <rule ref="category/java/documentation.xml">
+ <exclude name="CommentSize" />
+ </rule>
+ <rule ref="category/java/errorprone.xml">
+ <!-- <exclude name="..." /> -->
+ </rule>
+ <rule ref="category/java/multithreading.xml">
+ <!-- <exclude name="..." /> -->
+ </rule>
+ <rule ref="category/java/performance.xml">
+ <!-- <exclude name="..." /> -->
</rule>
</ruleset>
[08/10] commons-rng git commit: Avoid warning from invalid rule (PMD).
Posted by er...@apache.org.
Avoid warning from invalid rule (PMD).
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/14217515
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/14217515
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/14217515
Branch: refs/heads/master
Commit: 1421751589282c1b32b67abbf97be1237225cc8a
Parents: b01d0d1
Author: Gilles <er...@apache.org>
Authored: Thu Feb 22 13:23:34 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Thu Feb 22 13:23:34 2018 +0100
----------------------------------------------------------------------
src/main/resources/pmd/pmd-ruleset.xml | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/14217515/src/main/resources/pmd/pmd-ruleset.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/pmd/pmd-ruleset.xml b/src/main/resources/pmd/pmd-ruleset.xml
index 0db1c6e..2caa5cf 100644
--- a/src/main/resources/pmd/pmd-ruleset.xml
+++ b/src/main/resources/pmd/pmd-ruleset.xml
@@ -42,6 +42,7 @@
<exclude name="TooManyMethods" />
<exclude name="LawOfDemeter" />
<exclude name="NcssCount" />
+ <exclude name="LoosePackageCoupling" />
</rule>
<rule ref="category/java/documentation.xml">
<exclude name="CommentSize" />