/** * Merges the ClusteringFeature with an other ClusteringFeature. * * @param x the ClusteringFeature to merge with */ public void merge(ClusteringFeature x) { assert (this.sumPoints.length == x.sumPoints.length); this.numPoints += x.numPoints; super.setWeight(this.numPoints); for (int i = 0; i < this.sumPoints.length; i++) { this.sumPoints[i] += x.sumPoints[i]; } this.sumSquaredLength += x.sumSquaredLength; }
/** * Adds a point to the ClusteringFeature. * * @param numPoints the number of points to add * @param sumPoints the sum of points to add * @param sumSquaredPoints the sum of the squared lengths to add */ public void add(int numPoints, double[] sumPoints, double sumSquaredPoints) { assert (this.sumPoints.length == sumPoints.length); this.numPoints += numPoints; super.setWeight(this.numPoints); for (int i = 0; i < this.sumPoints.length; i++) { this.sumPoints[i] += sumPoints[i]; } this.sumSquaredLength += sumSquaredPoints; }
/** * Sets the threshold of the ClusteringFeature. * * @param threshold the threshold of the ClusteringFeature to set */ public void setThreshold(double threshold) { super.setRadius(threshold); }
/** * Sets the number of points of the ClusteringFeature. * * @param numPoints the number of points of the ClusteringFeature to set */ public void setNumPoints(int numPoints) { this.numPoints = numPoints; super.setWeight(numPoints); }