public class NonHierarchicalDistanceBasedAlgorithm<T extends ClusterItem> extends AbstractAlgorithm<T>
High level algorithm:
1. Iterate over items in the order they were added (candidate clusters).
2. Create a cluster with the center of the item.
3. Add all items that are within a certain distance to the cluster.
4. Move any items out of an existing cluster if they are closer to another cluster.
5. Remove those items from the list of candidate clusters.
Clusters have the center of the first element (not the centroid of the items within it).
Modifier and Type | Class and Description |
---|---|
protected static class |
NonHierarchicalDistanceBasedAlgorithm.QuadItem<T extends ClusterItem> |
Constructor and Description |
---|
NonHierarchicalDistanceBasedAlgorithm() |
Modifier and Type | Method and Description |
---|---|
boolean |
addItem(T item)
Adds an item to the algorithm
|
boolean |
addItems(java.util.Collection<T> items)
Adds a collection of items to the algorithm
|
void |
clearItems() |
protected java.util.Collection<NonHierarchicalDistanceBasedAlgorithm.QuadItem<T>> |
getClusteringItems(PointQuadTree<NonHierarchicalDistanceBasedAlgorithm.QuadItem<T>> quadTree,
float zoom) |
java.util.Set<? extends Cluster<T>> |
getClusters(float zoom) |
java.util.Collection<T> |
getItems() |
int |
getMaxDistanceBetweenClusteredItems() |
boolean |
removeItem(T item)
Removes an item from the algorithm
|
boolean |
removeItems(java.util.Collection<T> items)
Removes a collection of items from the algorithm
|
void |
setMaxDistanceBetweenClusteredItems(int maxDistance) |
boolean |
updateItem(T item)
Updates the provided item in the algorithm
|
lock, unlock
public NonHierarchicalDistanceBasedAlgorithm()
public boolean addItem(T item)
item
- the item to be addedpublic boolean addItems(java.util.Collection<T> items)
items
- the items to be addedpublic void clearItems()
public boolean removeItem(T item)
item
- the item to be removedpublic boolean removeItems(java.util.Collection<T> items)
items
- the items to be removedpublic boolean updateItem(T item)
item
- the item to be updatedprotected java.util.Collection<NonHierarchicalDistanceBasedAlgorithm.QuadItem<T>> getClusteringItems(PointQuadTree<NonHierarchicalDistanceBasedAlgorithm.QuadItem<T>> quadTree, float zoom)
public java.util.Collection<T> getItems()
public void setMaxDistanceBetweenClusteredItems(int maxDistance)
public int getMaxDistanceBetweenClusteredItems()