|
jInfer | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cz.cuni.mff.ksi.jinfer.twostep.clustering.withattributesiname.SimpleDataClusterer
public class SimpleDataClusterer
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 |
---|
public SimpleDataClusterer()
Method Detail |
---|
public void add(SimpleData item)
Clusterer
add
in interface Clusterer<SimpleData>
item
- to addpublic void addAll(Collection<SimpleData> items)
Clusterer
addAll
in interface Clusterer<SimpleData>
items
- elements to addpublic void cluster() throws InterruptedException
Clusterer
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.
cluster
in interface Clusterer<SimpleData>
InterruptedException
public SimpleData getRepresentantForItem(SimpleData item)
Clusterer
getRepresentantForItem
in interface Clusterer<SimpleData>
public List<Cluster<SimpleData>> getClusters()
Clusterer
getClusters
in interface Clusterer<SimpleData>
cluster
|
jInfer | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |