it.unibz.algorithms
Class DBScan

java.lang.Object
  extended by javax.swing.SwingWorker<java.lang.Void,java.lang.Void>
      extended by it.unibz.algorithms.DBScan
All Implemented Interfaces:
java.lang.Runnable, java.util.concurrent.Future<java.lang.Void>, java.util.concurrent.RunnableFuture<java.lang.Void>

public class DBScan
extends javax.swing.SwingWorker<java.lang.Void,java.lang.Void>

Class which represents the DBScan Algorithm in all its iterative steps. Extends SwingWorker in order to be executed as a background Thread and to keep control of progress.


Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.SwingWorker
javax.swing.SwingWorker.StateValue
 
Field Summary
private static java.util.List<Cluster> clusters
           
private  int e
           
private  int minp
           
private static java.util.List<Instance> pointsList
           
 
Constructor Summary
DBScan(java.util.List<Instance> Instances, int e, int minp)
          Base constructor with the epsilon and min-points values
 
Method Summary
private static boolean addNeighbors(Cluster cluster, Cluster cluster2)
          Method adds Instances of b to a if has to be updated
protected  java.lang.Void doInBackground()
          Executes the main DBScan algorithm composed by various steps Note: The various isCancelled() are used to proper stop this thread if the user closes the operation.
 java.util.List<Cluster> getClusters()
          Method returns all Clusters to be printed out
private static double getDistance(Instance p, Instance q)
          Method calculates the squaredistance beetween 2 Instances
private  java.util.List<Instance> getneighbors(Instance p)
          Method returns the list of Epsilonneighbors
 
Methods inherited from class javax.swing.SwingWorker
addPropertyChangeListener, cancel, done, execute, firePropertyChange, get, get, getProgress, getPropertyChangeSupport, getState, isCancelled, isDone, process, publish, removePropertyChangeListener, run, setProgress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pointsList

private static java.util.List<Instance> pointsList

clusters

private static java.util.List<Cluster> clusters

e

private int e

minp

private int minp
Constructor Detail

DBScan

public DBScan(java.util.List<Instance> Instances,
              int e,
              int minp)
Base constructor with the epsilon and min-points values

Method Detail

getClusters

public java.util.List<Cluster> getClusters()
Method returns all Clusters to be printed out


doInBackground

protected java.lang.Void doInBackground()
                                 throws java.lang.Exception
Executes the main DBScan algorithm composed by various steps Note: The various isCancelled() are used to proper stop this thread if the user closes the operation. Note: The setProgress() method calls are used to keep the ProgressBar up to date Source: Wikipedia 1. Starts with an arbitrary starting point that has not been visited. 2. This point's epsilon-neighborhood is retrieved, and if it contains sufficiently many points, a cluster is started. Otherwise, the point is labeled as noise. Note that this point might later be found in a sufficiently sized epsilon-environment of a different point and hence be made part of a cluster. 3. If a point is found to be part of a cluster, its epsilon-neighborhood is also part of that cluster. Hence, all points that are found within the epsilon-neighborhood are added, as is their own epsilon-neighborhood. 4. Continue this process until the cluster is completely found. Then, a new unvisited point is retrieved and processed, leading to the discovery of a further cluster or noise.

Specified by:
doInBackground in class javax.swing.SwingWorker<java.lang.Void,java.lang.Void>
Throws:
java.lang.Exception

getDistance

private static double getDistance(Instance p,
                                  Instance q)
Method calculates the squaredistance beetween 2 Instances


getneighbors

private java.util.List<Instance> getneighbors(Instance p)
Method returns the list of Epsilonneighbors

Parameters:
p - The Current Instance to investigate on
Returns:
List of neighbors

addNeighbors

private static boolean addNeighbors(Cluster cluster,
                                    Cluster cluster2)
Method adds Instances of b to a if has to be updated

Parameters:
cluster - final Instance set
cluster2 - Instance set to add
Returns:
True if successfully merged