
fr.vergne.downhill.DownhillCollider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of downhill-core Show documentation
Show all versions of downhill-core Show documentation
Implementation of the downhill collider algorithm.
The newest version!
package fr.vergne.downhill;
import java.util.Collection;
/**
* A {@link DownhillCollider} aims at merging elements together depending on
* some similarity measures. A close description can be found with Snowball Sampling,
* yet this is not exactly what we do here. However, the metaphor is the same:
* little snowballs are rolling downhill and merge together when they
* collide (touch each other). At the end, one or several big snowballs
* remain, which are completely separated and so could not collide.
*
* It is not a clustering algorithm, in the sense that it does not group
* the elements in several sets, but merge them together. It can be used
* as such if the balls are actually sets, which means that these sets
* will be merged together, producing a clustering. But it is a specific
* algorithm which can manage only certain types of clustering, not all of them.
*
* @author Matthieu Vergne
*
* @param
*/
public interface DownhillCollider {
/**
*
* @param balls
* the balls to roll downhill
* @param colliders
* the set of collision rules
* @return the set of balls remaining when no merging possibility remains
*/
public Collection rolls(Collection balls,
Collider... colliders);
/**
* A {@link Collider} describe how collision are managed.
*
* @author Matthieu Vergne
*
* @param
*/
public static interface Collider {
/**
*
* @param b1
* a ball
* @param b2
* another ball
* @return true
if the balls are colliding,
* false
otherwise
*/
public boolean areColliding(Ball b1, Ball b2);
/**
*
* @param b1
* a ball
* @param b2
* another ball
* @return the merging of the two balls in a single one
*/
public Ball collide(Ball b1, Ball b2);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy