Skip to content

Commit

Permalink
Checkstyle: private final class should be declared as final
Browse files Browse the repository at this point in the history
  • Loading branch information
aherbert committed Nov 18, 2023
1 parent 34826e8 commit 985e305
Show file tree
Hide file tree
Showing 36 changed files with 94 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class JDKRandom extends IntProvider {
* @see <a href="http://www.ibm.com/developerworks/library/se-lookahead/">
* IBM DeveloperWorks Article: Look-ahead Java deserialization</a>
*/
private static class ValidatingObjectInputStream extends ObjectInputStream {
private static final class ValidatingObjectInputStream extends ObjectInputStream {
/**
* @param in Input stream
* @throws IOException Signals that an I/O exception has occurred.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class SplittableProvidersParametricTest {
* All generation and split methods throw an exception. This can be used to test
* exception conditions for arguments to default stream functions.
*/
private static class DummyGenerator implements SplittableUniformRandomProvider {
private static final class DummyGenerator implements SplittableUniformRandomProvider {
/** An instance. */
static final DummyGenerator INSTANCE = new DummyGenerator();

Expand All @@ -65,7 +65,7 @@ public SplittableUniformRandomProvider split(UniformRandomProvider source) {
* Generation methods default to ThreadLocalRandom. Split methods return the same instance.
* This is a functioning generator that can be used as a source to seed splitting.
*/
private static class ThreadLocalGenerator implements SplittableUniformRandomProvider {
private static final class ThreadLocalGenerator implements SplittableUniformRandomProvider {
/** An instance. */
static final ThreadLocalGenerator INSTANCE = new ThreadLocalGenerator();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class L32X64MixTest extends AbstractLXMTest {
* Factory to create a composite LXM generator that is equivalent
* to the RNG under test.
*/
private static class Factory implements LXMGeneratorFactory {
private static final class Factory implements LXMGeneratorFactory {
static final Factory INSTANCE = new Factory();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class L128X1024MixTest extends AbstractLXMTest {
* Factory to create a composite LXM generator that is equivalent
* to the RNG under test.
*/
private static class Factory implements LXMGeneratorFactory {
private static final class Factory implements LXMGeneratorFactory {
static final Factory INSTANCE = new Factory();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class L128X128MixTest extends AbstractLXMTest {
* Factory to create a composite LXM generator that is equivalent
* to the RNG under test.
*/
private static class Factory implements LXMGeneratorFactory {
private static final class Factory implements LXMGeneratorFactory {
static final Factory INSTANCE = new Factory();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class L128X256MixTest extends AbstractLXMTest {
* Factory to create a composite LXM generator that is equivalent
* to the RNG under test.
*/
private static class Factory implements LXMGeneratorFactory {
private static final class Factory implements LXMGeneratorFactory {
static final Factory INSTANCE = new Factory();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class L64X1024MixTest extends AbstractLXMTest {
* Factory to create a composite LXM generator that is equivalent
* to the RNG under test.
*/
private static class Factory implements LXMGeneratorFactory {
private static final class Factory implements LXMGeneratorFactory {
static final Factory INSTANCE = new Factory();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class L64X128MixTest extends AbstractLXMTest {
* Factory to create a composite LXM generator that is equivalent
* to the RNG under test.
*/
private static class Factory implements LXMGeneratorFactory {
private static final class Factory implements LXMGeneratorFactory {
static final Factory INSTANCE = new Factory();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class L64X128StarStarTest extends AbstractLXMTest {
* Factory to create a composite LXM generator that is equivalent
* to the RNG under test.
*/
private static class Factory implements LXMGeneratorFactory {
private static final class Factory implements LXMGeneratorFactory {
static final Factory INSTANCE = new Factory();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class L64X256MixTest extends AbstractLXMTest {
* Factory to create a composite LXM generator that is equivalent
* to the RNG under test.
*/
private static class Factory implements LXMGeneratorFactory {
private static final class Factory implements LXMGeneratorFactory {
static final Factory INSTANCE = new Factory();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public SharedStateDiscreteSampler create(UniformRandomProvider rng, double[] pro
* sampler given a factory and the probability distribution. Each new instance will recreate
* the distribution sampler using the factory.
*/
private static class SharedStateDiscreteProbabilitySampler implements SharedStateDiscreteSampler {
private static final class SharedStateDiscreteProbabilitySampler implements SharedStateDiscreteSampler {
/** The sampler. */
private final DiscreteSampler sampler;
/** The factory to create a new discrete sampler. */
Expand Down Expand Up @@ -243,7 +243,7 @@ public interface Builder<S> {
*
* @param <S> Type of sampler
*/
private static class SamplerBuilder<S> implements Builder<S> {
private static final class SamplerBuilder<S> implements Builder<S> {
/** The specialisation of the sampler. */
private final Specialisation specialisation;
/** The weighted samplers. */
Expand Down Expand Up @@ -295,7 +295,7 @@ S createSampler(DiscreteSampler discreteSampler,
*
* @param <S> Sampler type
*/
private static class WeightedSampler<S> {
private static final class WeightedSampler<S> {
/** The weight. */
private final double weight;
/** The sampler. */
Expand Down Expand Up @@ -593,7 +593,7 @@ S nextSampler() {
*
* @param <T> Type of sample
*/
private static class ObjectSamplerFactory<T> implements
private static final class ObjectSamplerFactory<T> implements
SamplerBuilder.SamplerFactory<ObjectSampler<T>> {
/** The instance. */
@SuppressWarnings("rawtypes")
Expand Down Expand Up @@ -621,7 +621,7 @@ public ObjectSampler<T> createSampler(DiscreteSampler discreteSampler,
*
* @param <T> Type of sample
*/
private static class CompositeObjectSampler<T>
private static final class CompositeObjectSampler<T>
extends CompositeSampler<ObjectSampler<T>>
implements ObjectSampler<T> {
/**
Expand All @@ -645,7 +645,7 @@ public T sample() {
*
* @param <T> Type of sample
*/
private static class SharedStateObjectSamplerFactory<T> implements
private static final class SharedStateObjectSamplerFactory<T> implements
SamplerBuilder.SamplerFactory<SharedStateObjectSampler<T>> {
/** The instance. */
@SuppressWarnings("rawtypes")
Expand Down Expand Up @@ -678,7 +678,7 @@ public SharedStateObjectSampler<T> createSampler(DiscreteSampler discreteSampler
*
* @param <T> Type of sample
*/
private static class CompositeSharedStateObjectSampler<T>
private static final class CompositeSharedStateObjectSampler<T>
extends CompositeSampler<SharedStateObjectSampler<T>>
implements SharedStateObjectSampler<T> {
/**
Expand Down Expand Up @@ -708,7 +708,7 @@ public CompositeSharedStateObjectSampler<T> withUniformRandomProvider(UniformRan
/**
* A factory for creating a composite DiscreteSampler.
*/
private static class DiscreteSamplerFactory implements
private static final class DiscreteSamplerFactory implements
SamplerBuilder.SamplerFactory<DiscreteSampler> {
/** The instance. */
static final DiscreteSamplerFactory INSTANCE = new DiscreteSamplerFactory();
Expand All @@ -722,7 +722,7 @@ public DiscreteSampler createSampler(DiscreteSampler discreteSampler,
/**
* A composite discrete sampler.
*/
private static class CompositeDiscreteSampler
private static final class CompositeDiscreteSampler
extends CompositeSampler<DiscreteSampler>
implements DiscreteSampler {
/**
Expand All @@ -744,7 +744,7 @@ public int sample() {
/**
* A factory for creating a composite SharedStateDiscreteSampler.
*/
private static class SharedStateDiscreteSamplerFactory implements
private static final class SharedStateDiscreteSamplerFactory implements
SamplerBuilder.SamplerFactory<SharedStateDiscreteSampler> {
/** The instance. */
static final SharedStateDiscreteSamplerFactory INSTANCE = new SharedStateDiscreteSamplerFactory();
Expand All @@ -760,7 +760,7 @@ public SharedStateDiscreteSampler createSampler(DiscreteSampler discreteSampler,
/**
* A composite discrete sampler with shared state support.
*/
private static class CompositeSharedStateDiscreteSampler
private static final class CompositeSharedStateDiscreteSampler
extends CompositeSampler<SharedStateDiscreteSampler>
implements SharedStateDiscreteSampler {
/**
Expand Down Expand Up @@ -790,7 +790,7 @@ public CompositeSharedStateDiscreteSampler withUniformRandomProvider(UniformRand
/**
* A factory for creating a composite ContinuousSampler.
*/
private static class ContinuousSamplerFactory implements
private static final class ContinuousSamplerFactory implements
SamplerBuilder.SamplerFactory<ContinuousSampler> {
/** The instance. */
static final ContinuousSamplerFactory INSTANCE = new ContinuousSamplerFactory();
Expand All @@ -804,7 +804,7 @@ public ContinuousSampler createSampler(DiscreteSampler discreteSampler,
/**
* A composite continuous sampler.
*/
private static class CompositeContinuousSampler
private static final class CompositeContinuousSampler
extends CompositeSampler<ContinuousSampler>
implements ContinuousSampler {
/**
Expand All @@ -826,7 +826,7 @@ public double sample() {
/**
* A factory for creating a composite SharedStateContinuousSampler.
*/
private static class SharedStateContinuousSamplerFactory implements
private static final class SharedStateContinuousSamplerFactory implements
SamplerBuilder.SamplerFactory<SharedStateContinuousSampler> {
/** The instance. */
static final SharedStateContinuousSamplerFactory INSTANCE = new SharedStateContinuousSamplerFactory();
Expand All @@ -842,7 +842,7 @@ public SharedStateContinuousSampler createSampler(DiscreteSampler discreteSample
/**
* A composite continuous sampler with shared state support.
*/
private static class CompositeSharedStateContinuousSampler
private static final class CompositeSharedStateContinuousSampler
extends CompositeSampler<SharedStateContinuousSampler>
implements SharedStateContinuousSampler {
/**
Expand Down Expand Up @@ -872,7 +872,7 @@ public CompositeSharedStateContinuousSampler withUniformRandomProvider(UniformRa
/**
* A factory for creating a composite LongSampler.
*/
private static class LongSamplerFactory implements
private static final class LongSamplerFactory implements
SamplerBuilder.SamplerFactory<LongSampler> {
/** The instance. */
static final LongSamplerFactory INSTANCE = new LongSamplerFactory();
Expand All @@ -886,7 +886,7 @@ public LongSampler createSampler(DiscreteSampler discreteSampler,
/**
* A composite long sampler.
*/
private static class CompositeLongSampler
private static final class CompositeLongSampler
extends CompositeSampler<LongSampler>
implements LongSampler {
/**
Expand All @@ -908,7 +908,7 @@ public long sample() {
/**
* A factory for creating a composite SharedStateLongSampler.
*/
private static class SharedStateLongSamplerFactory implements
private static final class SharedStateLongSamplerFactory implements
SamplerBuilder.SamplerFactory<SharedStateLongSampler> {
/** The instance. */
static final SharedStateLongSamplerFactory INSTANCE = new SharedStateLongSamplerFactory();
Expand All @@ -924,7 +924,7 @@ public SharedStateLongSampler createSampler(DiscreteSampler discreteSampler,
/**
* A composite long sampler with shared state support.
*/
private static class CompositeSharedStateLongSampler
private static final class CompositeSharedStateLongSampler
extends CompositeSampler<SharedStateLongSampler>
implements SharedStateLongSampler {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class UnitSphereSampler implements SharedStateObjectSampler<double[]> {
/**
* Sample uniformly from the ends of a 1D unit line.
*/
private static class UnitSphereSampler1D extends UnitSphereSampler {
private static final class UnitSphereSampler1D extends UnitSphereSampler {
/** The source of randomness. */
private final UniformRandomProvider rng;

Expand Down Expand Up @@ -87,7 +87,7 @@ public UnitSphereSampler withUniformRandomProvider(UniformRandomProvider rng) {
* Sample uniformly from a 2D unit circle.
* This is a 2D specialisation of the UnitSphereSamplerND.
*/
private static class UnitSphereSampler2D extends UnitSphereSampler {
private static final class UnitSphereSampler2D extends UnitSphereSampler {
/** Sampler used for generating the individual components of the vectors. */
private final NormalizedGaussianSampler sampler;

Expand Down Expand Up @@ -123,7 +123,7 @@ public UnitSphereSampler withUniformRandomProvider(UniformRandomProvider rng) {
* Sample uniformly from a 3D unit sphere.
* This is a 3D specialisation of the UnitSphereSamplerND.
*/
private static class UnitSphereSampler3D extends UnitSphereSampler {
private static final class UnitSphereSampler3D extends UnitSphereSampler {
/** Sampler used for generating the individual components of the vectors. */
private final NormalizedGaussianSampler sampler;

Expand Down Expand Up @@ -159,7 +159,7 @@ public UnitSphereSampler withUniformRandomProvider(UniformRandomProvider rng) {
/**
* Sample uniformly from a ND unit sphere.
*/
private static class UnitSphereSamplerND extends UnitSphereSampler {
private static final class UnitSphereSamplerND extends UnitSphereSampler {
/** Space dimension. */
private final int dimension;
/** Sampler used for generating the individual components of the vectors. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public String toString() {
* Computing, 12, 223-246, 1974.
* </blockquote>
*/
private static class AhrensDieterGammaSampler
private static final class AhrensDieterGammaSampler
extends BaseGammaSampler {

/** Inverse of "alpha". */
Expand Down Expand Up @@ -196,7 +196,7 @@ public SharedStateContinuousSampler withUniformRandomProvider(UniformRandomProvi
* Volume 26 Issue 3, September, 2000.
* </blockquote>
*/
private static class MarsagliaTsangGammaSampler
private static final class MarsagliaTsangGammaSampler
extends BaseGammaSampler {

/** 1/3. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public class AliasMethodDiscreteSampler
*
* <p>Sampling uses 1 or 2 calls to {@link UniformRandomProvider#nextInt()}.</p>
*/
private static class SmallTableAliasMethodDiscreteSampler extends AliasMethodDiscreteSampler {
private static final class SmallTableAliasMethodDiscreteSampler extends AliasMethodDiscreteSampler {
/** The mask to isolate the lower bits. */
private final int mask;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ protected double computeX(double w) {
* Computes one sample using Cheng's BB algorithm, when beta distribution {@code alpha} and
* {@code beta} shape parameters are both larger than 1.
*/
private static class ChengBBBetaSampler extends BaseChengBetaSampler {
private static final class ChengBBBetaSampler extends BaseChengBetaSampler {
/** 1 + natural logarithm of 5. */
private static final double LN_5_P1 = 1 + Math.log(5.0);

Expand Down Expand Up @@ -210,7 +210,7 @@ public SharedStateContinuousSampler withUniformRandomProvider(UniformRandomProvi
* Computes one sample using Cheng's BC algorithm, when at least one of beta distribution
* {@code alpha} or {@code beta} shape parameters is smaller than 1.
*/
private static class ChengBCBetaSampler extends BaseChengBetaSampler {
private static final class ChengBCBetaSampler extends BaseChengBetaSampler {
/** 1/2. */
private static final double ONE_HALF = 1d / 2;
/** 1/4. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class ContinuousUniformSampler
/**
* Specialization to sample from an open interval {@code (lo, hi)}.
*/
private static class OpenIntervalContinuousUniformSampler extends ContinuousUniformSampler {
private static final class OpenIntervalContinuousUniformSampler extends ContinuousUniformSampler {
/**
* @param rng Generator of uniformly distributed random numbers.
* @param lo Lower bound.
Expand Down
Loading

0 comments on commit 985e305

Please sign in to comment.