mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-25 21:43:49 +00:00
Implemented cluster groups
This commit is contained in:
1 parent
8fb3f3e9a9
commit
e228e7ed67
3 files changed
+62
No files matched your search
+28
@@ -0,0 +1,28 @@
|
||||
package com.sap.sse.datamining.impl.data;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sse.datamining.data.ClusterGroup;
|
||||
|
||||
public class TestFixClusterGroup {
|
||||
|
||||
public static final Comparator<Integer> comparator = new ComparableComparator<Integer>();
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testClusterGroupWithClosedBoundaries() {
|
||||
ClusterGroup<Integer> groupWithClosedBoundaries = createGroupWithClosedBoundaries();
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
private ClusterGroup<Integer> createGroupWithClosedBoundaries() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.sap.sse.datamining.data;
|
||||
|
||||
public interface ClusterGroup<ElementType> {
|
||||
|
||||
public Cluster<ElementType> getClusterFor(ElementType value);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.sap.sse.datamining.impl.data;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.sap.sse.datamining.data.Cluster;
|
||||
import com.sap.sse.datamining.data.ClusterGroup;
|
||||
|
||||
public class FixClusterGroup<ElementType> implements ClusterGroup<ElementType> {
|
||||
|
||||
private final Iterable<Cluster<ElementType>> clusters;
|
||||
|
||||
public FixClusterGroup(Collection<Cluster<ElementType>> clusters) {
|
||||
this.clusters = new HashSet<>(clusters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cluster<ElementType> getClusterFor(ElementType value) {
|
||||
for (Cluster<ElementType> cluster : clusters) {
|
||||
if (cluster.isInRange(value)) {
|
||||
return cluster;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user