Avoid usage of "clone" (suggested by "sonarcloud").
This commit is contained in:
parent
1c737b3570
commit
b5fd55e6b9
|
@ -237,12 +237,13 @@ public class PSquarePercentile extends AbstractStorelessUnivariateStatistic
|
||||||
PSquarePercentile copy = new PSquarePercentile(100d * quantile);
|
PSquarePercentile copy = new PSquarePercentile(100d * quantile);
|
||||||
|
|
||||||
if (markers != null) {
|
if (markers != null) {
|
||||||
copy.markers = (PSquareMarkers) markers.clone();
|
copy.markers = markers.copy();
|
||||||
}
|
}
|
||||||
copy.countOfObservations = countOfObservations;
|
copy.countOfObservations = countOfObservations;
|
||||||
copy.pValue = pValue;
|
copy.pValue = pValue;
|
||||||
copy.initialFive.clear();
|
copy.initialFive.clear();
|
||||||
copy.initialFive.addAll(initialFive);
|
copy.initialFive.addAll(initialFive);
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,19 +558,19 @@ public class PSquarePercentile extends AbstractStorelessUnivariateStatistic
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}.Clone Markers
|
* Copy markers.
|
||||||
*
|
*
|
||||||
* @return cloned object
|
* @return a new instance.
|
||||||
*/
|
*/
|
||||||
@Override
|
public Markers copy() {
|
||||||
public Object clone() {
|
return new Markers(new Marker[] {
|
||||||
return new Markers(new Marker[] { new Marker(),
|
new Marker(),
|
||||||
(Marker) markerArray[1].clone(),
|
markerArray[1].copy(),
|
||||||
(Marker) markerArray[2].clone(),
|
markerArray[2].copy(),
|
||||||
(Marker) markerArray[3].clone(),
|
markerArray[3].copy(),
|
||||||
(Marker) markerArray[4].clone(),
|
markerArray[4].copy(),
|
||||||
(Marker) markerArray[5].clone() });
|
markerArray[5].copy()
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -590,7 +591,7 @@ public class PSquarePercentile extends AbstractStorelessUnivariateStatistic
|
||||||
/**
|
/**
|
||||||
* The class modeling the attributes of the marker of the P-square algorithm.
|
* The class modeling the attributes of the marker of the P-square algorithm.
|
||||||
*/
|
*/
|
||||||
private static final class Marker implements Serializable, Cloneable {
|
private static final class Marker implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serial Version ID.
|
* Serial Version ID.
|
||||||
|
@ -846,12 +847,11 @@ public class PSquarePercentile extends AbstractStorelessUnivariateStatistic
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clone this instance.
|
* Copy this instance.
|
||||||
*
|
*
|
||||||
* @return cloned marker
|
* @return a new instance.
|
||||||
*/
|
*/
|
||||||
@Override
|
public Marker copy() {
|
||||||
public Object clone() {
|
|
||||||
return new Marker(markerHeight, desiredMarkerPosition, desiredMarkerIncrement, intMarkerPosition);
|
return new Marker(markerHeight, desiredMarkerPosition, desiredMarkerIncrement, intMarkerPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -944,7 +944,7 @@ public class PSquarePercentile extends AbstractStorelessUnivariateStatistic
|
||||||
* P-square algorithm markers as is explained in the original works. This
|
* P-square algorithm markers as is explained in the original works. This
|
||||||
* interface is exposed with protected access to help in testability.
|
* interface is exposed with protected access to help in testability.
|
||||||
*/
|
*/
|
||||||
protected interface PSquareMarkers extends Cloneable {
|
protected interface PSquareMarkers {
|
||||||
/**
|
/**
|
||||||
* Returns Percentile value computed thus far.
|
* Returns Percentile value computed thus far.
|
||||||
*
|
*
|
||||||
|
@ -952,15 +952,6 @@ public class PSquarePercentile extends AbstractStorelessUnivariateStatistic
|
||||||
*/
|
*/
|
||||||
double getPercentileValue();
|
double getPercentileValue();
|
||||||
|
|
||||||
/**
|
|
||||||
* A clone function to clone the current instance. It's created as an
|
|
||||||
* interface method as well for convenience though Cloneable is just a
|
|
||||||
* marker interface.
|
|
||||||
*
|
|
||||||
* @return clone of this instance
|
|
||||||
*/
|
|
||||||
Object clone();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the marker height (or percentile) of a given marker index.
|
* Returns the marker height (or percentile) of a given marker index.
|
||||||
*
|
*
|
||||||
|
@ -970,6 +961,13 @@ public class PSquarePercentile extends AbstractStorelessUnivariateStatistic
|
||||||
*/
|
*/
|
||||||
double height(int markerIndex);
|
double height(int markerIndex);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy factory.
|
||||||
|
*
|
||||||
|
* @return a new instance
|
||||||
|
*/
|
||||||
|
PSquareMarkers copy();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process a data point by moving the marker heights based on estimator.
|
* Process a data point by moving the marker heights based on estimator.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue