jInfer

cz.cuni.mff.ksi.jinfer.twostep.clustering.withattributesiname
Class SimpleDataClusterer

java.lang.Object
  extended by cz.cuni.mff.ksi.jinfer.twostep.clustering.withattributesiname.SimpleDataClusterer
All Implemented Interfaces:
Clusterer<SimpleData>

public class SimpleDataClusterer
extends Object
implements Clusterer<SimpleData>

Helper class to cluster simpleData inside one element.


Constructor Summary
SimpleDataClusterer()
          Default constructor.
 
Method Summary
 void add(SimpleData item)
          Add x to some clusterer, enqueue for processing.
 void addAll(Collection<SimpleData> items)
          Add the whole collection to queue for clustering
 void cluster()
          Do the main job, cluster enqueued items into clusters.
 List<Cluster<SimpleData>> getClusters()
          Without doing clustering again, return result of last cluster() call.
 SimpleData getRepresentantForItem(SimpleData item)
          Return representative of the item's cluster
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleDataClusterer

public SimpleDataClusterer()
Default constructor.

Method Detail

add

public void add(SimpleData item)
Description copied from interface: Clusterer
Add x to some clusterer, enqueue for processing. Don't implement clustering here, has to be in cluster() method to enable thread interruption.

Specified by:
add in interface Clusterer<SimpleData>
Parameters:
item - to add

addAll

public void addAll(Collection<SimpleData> items)
Description copied from interface: Clusterer
Add the whole collection to queue for clustering

Specified by:
addAll in interface Clusterer<SimpleData>
Parameters:
items - elements to add

cluster

public void cluster()
             throws InterruptedException
Description copied from interface: Clusterer
Do the main job, cluster enqueued items into clusters. But don't throw away old items. If there are already some items in clusters, user suppose they didn't disappeared.

Example: add(x), add(y), add(xx), add(yx), enqueued items: x, y, xx, yx. Calling cluster() creates clusters for example based on starting letter. Creates two clusters: (x, xx) | (y, yx)

Now let user use add(xd), add(zz). Calling cluster() again have to result in (x, xx, xd) | (y, yx) | (zz)

Of course, if cluster criterion is not so stable as first letter, items x, xx, y, yx can change their clusters and so. Point is, that they don't disappear. Once an item is added clusterer has to hold it for future cluster() calls. cluster method has to check for interruption of thread by using: if (Thread.interrupted()) { throw new InterruptedException(); } in some main loop.

Specified by:
cluster in interface Clusterer<SimpleData>
Throws:
InterruptedException

getRepresentantForItem

public SimpleData getRepresentantForItem(SimpleData item)
Description copied from interface: Clusterer
Return representative of the item's cluster

Specified by:
getRepresentantForItem in interface Clusterer<SimpleData>
Returns:

getClusters

public List<Cluster<SimpleData>> getClusters()
Description copied from interface: Clusterer
Without doing clustering again, return result of last cluster() call.

Specified by:
getClusters in interface Clusterer<SimpleData>
Returns:
all clusters obtained by last call of cluster

jInfer

Generated on Fri Dec 9 00:01:25 CET 2011