jInfer

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

java.lang.Object
  extended by cz.cuni.mff.ksi.jinfer.twostep.clustering.withattributesiname.Iname
All Implemented Interfaces:
Clusterer<AbstractStructuralNode>, ClustererWithAttributes<AbstractStructuralNode,Attribute>

public class Iname
extends Object
implements ClustererWithAttributes<AbstractStructuralNode,Attribute>

Cluster nodes by name - ignoring case. Clustering is done by iterating queued items for clustering, for each item, iterate clusters. If any representant is of same type (SimpleData, Element,Attribute) add item to cluster. If cluster is not found, create new with item as representant. For SimpleData, check for same name is omitted, all simpledata ends up in one cluster for each element.


Constructor Summary
Iname()
          Default constructor.
 
Method Summary
 void add(AbstractStructuralNode item)
          Add x to some clusterer, enqueue for processing.
 void addAll(Collection<AbstractStructuralNode> items)
          Add the whole collection to queue for clustering
 void cluster()
          Do the main job, cluster enqueued items into clusters.
 List<Cluster<Attribute>> getAttributeClusters(AbstractStructuralNode representant)
          Returns all clusters of attributes for a given representative of cluster (for a given element cluster de facto).
 List<Cluster<AbstractStructuralNode>> getClusters()
          Without doing clustering again, return result of last cluster() call.
 AbstractStructuralNode getRepresentantForItem(AbstractStructuralNode 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

Iname

public Iname()
Default constructor.

Method Detail

add

public void add(AbstractStructuralNode 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<AbstractStructuralNode>
Parameters:
item - to add

addAll

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

Specified by:
addAll in interface Clusterer<AbstractStructuralNode>
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<AbstractStructuralNode>
Throws:
InterruptedException

getRepresentantForItem

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

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

getClusters

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

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

getAttributeClusters

public List<Cluster<Attribute>> getAttributeClusters(AbstractStructuralNode representant)
Description copied from interface: ClustererWithAttributes
Returns all clusters of attributes for a given representative of cluster (for a given element cluster de facto). Attributes have to be collected from elements.

Specified by:
getAttributeClusters in interface ClustererWithAttributes<AbstractStructuralNode,Attribute>
Returns:

jInfer

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