DBSCANClusterer implements Clusterer { @Override public List<List<double[]>> cluster(double[][] input) { List<double[]> cluster = new ArrayList<>(); myPointTypes = new PointType[input.length]; for (int i = 0; i < input.length; i++) { if (myPointTypes[i] == null) { if (expandCluster(input, i, cluster)) { if (!cluster.isEmpty()) { myClusters.add(cluster); myVisited += cluster.size(); notifyProgress(); } cluster = new ArrayList<>(); } } } return myClusters; } DBSCANClusterer(float eps, int minPts);  DBSCANClusterer(float eps, int minPts, ProgressListener listener); @Override List<List<double[]>> cluster(double[][] input);  }
@Test public void testCluster() throws Exception { DBSCANClusterer clusterer = new DBSCANClusterer(1, 1); List<List<double[]>> cluster = clusterer.cluster(DATA); assertNotNull(cluster); assertEquals(2, cluster.size()); DBSCANClusterer clusterer2 = new DBSCANClusterer(1, 0); List<List<double[]>> cluster2 = clusterer2.cluster(DATA); assertNotNull(cluster2); assertEquals(5, cluster2.size()); DBSCANClusterer clusterer3 = new DBSCANClusterer(1, 0); List<List<double[]>> cluster3 = clusterer3.cluster(DATA_2); assertNotNull(cluster3); assertEquals(4, cluster3.size()); }