Use explicit constructor invocation ("this").
This commit is contained in:
parent
412a8a0ba6
commit
0338025679
|
@ -26,6 +26,7 @@ import org.apache.commons.math4.exception.MathInternalError;
|
||||||
import org.apache.commons.math4.exception.NotANumberException;
|
import org.apache.commons.math4.exception.NotANumberException;
|
||||||
import org.apache.commons.math4.random.RandomDataGenerator;
|
import org.apache.commons.math4.random.RandomDataGenerator;
|
||||||
import org.apache.commons.math4.random.RandomGenerator;
|
import org.apache.commons.math4.random.RandomGenerator;
|
||||||
|
import org.apache.commons.math4.random.Well19937c;
|
||||||
import org.apache.commons.math4.util.FastMath;
|
import org.apache.commons.math4.util.FastMath;
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,10 +89,7 @@ public class NaturalRanking implements RankingAlgorithm {
|
||||||
* Create a NaturalRanking with default strategies for handling ties and NaNs.
|
* Create a NaturalRanking with default strategies for handling ties and NaNs.
|
||||||
*/
|
*/
|
||||||
public NaturalRanking() {
|
public NaturalRanking() {
|
||||||
super();
|
this(DEFAULT_NAN_STRATEGY, DEFAULT_TIES_STRATEGY, null);
|
||||||
tiesStrategy = DEFAULT_TIES_STRATEGY;
|
|
||||||
nanStrategy = DEFAULT_NAN_STRATEGY;
|
|
||||||
randomData = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,10 +98,7 @@ public class NaturalRanking implements RankingAlgorithm {
|
||||||
* @param tiesStrategy the TiesStrategy to use
|
* @param tiesStrategy the TiesStrategy to use
|
||||||
*/
|
*/
|
||||||
public NaturalRanking(TiesStrategy tiesStrategy) {
|
public NaturalRanking(TiesStrategy tiesStrategy) {
|
||||||
super();
|
this(DEFAULT_NAN_STRATEGY, tiesStrategy, new Well19937c());
|
||||||
this.tiesStrategy = tiesStrategy;
|
|
||||||
nanStrategy = DEFAULT_NAN_STRATEGY;
|
|
||||||
randomData = new RandomDataGenerator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -112,10 +107,7 @@ public class NaturalRanking implements RankingAlgorithm {
|
||||||
* @param nanStrategy the NaNStrategy to use
|
* @param nanStrategy the NaNStrategy to use
|
||||||
*/
|
*/
|
||||||
public NaturalRanking(NaNStrategy nanStrategy) {
|
public NaturalRanking(NaNStrategy nanStrategy) {
|
||||||
super();
|
this(nanStrategy, DEFAULT_TIES_STRATEGY, null);
|
||||||
this.nanStrategy = nanStrategy;
|
|
||||||
tiesStrategy = DEFAULT_TIES_STRATEGY;
|
|
||||||
randomData = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -125,10 +117,7 @@ public class NaturalRanking implements RankingAlgorithm {
|
||||||
* @param tiesStrategy TiesStrategy to use
|
* @param tiesStrategy TiesStrategy to use
|
||||||
*/
|
*/
|
||||||
public NaturalRanking(NaNStrategy nanStrategy, TiesStrategy tiesStrategy) {
|
public NaturalRanking(NaNStrategy nanStrategy, TiesStrategy tiesStrategy) {
|
||||||
super();
|
this(nanStrategy, tiesStrategy, new Well19937c());
|
||||||
this.nanStrategy = nanStrategy;
|
|
||||||
this.tiesStrategy = tiesStrategy;
|
|
||||||
randomData = new RandomDataGenerator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,13 +127,9 @@ public class NaturalRanking implements RankingAlgorithm {
|
||||||
* @param randomGenerator source of random data
|
* @param randomGenerator source of random data
|
||||||
*/
|
*/
|
||||||
public NaturalRanking(RandomGenerator randomGenerator) {
|
public NaturalRanking(RandomGenerator randomGenerator) {
|
||||||
super();
|
this(DEFAULT_NAN_STRATEGY, TiesStrategy.RANDOM, randomGenerator);
|
||||||
this.tiesStrategy = TiesStrategy.RANDOM;
|
|
||||||
nanStrategy = DEFAULT_NAN_STRATEGY;
|
|
||||||
randomData = new RandomDataGenerator(randomGenerator);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a NaturalRanking with the given NaNStrategy, TiesStrategy.RANDOM
|
* Create a NaturalRanking with the given NaNStrategy, TiesStrategy.RANDOM
|
||||||
* and the given source of random data.
|
* and the given source of random data.
|
||||||
|
@ -153,10 +138,20 @@ public class NaturalRanking implements RankingAlgorithm {
|
||||||
* @param randomGenerator source of random data
|
* @param randomGenerator source of random data
|
||||||
*/
|
*/
|
||||||
public NaturalRanking(NaNStrategy nanStrategy,
|
public NaturalRanking(NaNStrategy nanStrategy,
|
||||||
RandomGenerator randomGenerator) {
|
RandomGenerator randomGenerator) {
|
||||||
super();
|
this(nanStrategy, TiesStrategy.RANDOM, randomGenerator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param nanStrategy NaN strategy.
|
||||||
|
* @param randomGenerator RNG.
|
||||||
|
* @param tiesStrategy Tie strategy.
|
||||||
|
*/
|
||||||
|
private NaturalRanking(NaNStrategy nanStrategy,
|
||||||
|
TiesStrategy tiesStrategy,
|
||||||
|
RandomGenerator randomGenerator) {
|
||||||
this.nanStrategy = nanStrategy;
|
this.nanStrategy = nanStrategy;
|
||||||
this.tiesStrategy = TiesStrategy.RANDOM;
|
this.tiesStrategy = tiesStrategy;
|
||||||
randomData = new RandomDataGenerator(randomGenerator);
|
randomData = new RandomDataGenerator(randomGenerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue