< Summary

Class:SizeAndRadiusConstrainedClustererBase
Assembly:bamlab.micromissiles
File(s):/github/workspace/Assets/Scripts/Algorithms/Clustering/SizeAndRadiusConstrainedClustererBase.cs
Covered lines:8
Uncovered lines:2
Coverable lines:10
Total lines:26
Line coverage:80% (8 of 10)
Covered branches:0
Total branches:0
Covered methods:1
Total methods:1
Method coverage:100% (1 of 1)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SizeAndRadiusConstrainedClustererBase(...)0%3.263069.23%

File(s)

/github/workspace/Assets/Scripts/Algorithms/Clustering/SizeAndRadiusConstrainedClustererBase.cs

#LineLine coverage
 1using System;
 2
 3// Base implementation of a size and radius-constrained clustering algorithm.
 4//
 5// The size is defined as the maximum number of hierarchical objects within a cluster, and the
 6// radius denotes the maximum distance from the cluster's centroid to any of its assigned
 7// hierarchical objects.
 8public abstract class SizeAndRadiusConstrainedClustererBase : ClustererBase {
 9  // Maximum cluster size.
 1310  protected readonly int _maxSize = 0;
 11
 12  // Maximum cluster radius.
 1313  protected readonly float _maxRadius = 0;
 14
 2615  public SizeAndRadiusConstrainedClustererBase(int maxSize, float maxRadius) {
 1316    if (maxSize <= 0) {
 017      throw new ArgumentOutOfRangeException("Maximum size must be positive.", nameof(maxSize));
 18    }
 1319    if (maxRadius < 0) {
 020      throw new ArgumentOutOfRangeException("Maximum radius must be non-negative.",
 21                                            nameof(maxRadius));
 22    }
 1323    _maxSize = maxSize;
 1324    _maxRadius = maxRadius;
 1325  }
 26}