Package elki.result.textwriter.naming
Class SimpleEnumeratingScheme
- java.lang.Object
-
- elki.result.textwriter.naming.SimpleEnumeratingScheme
-
- All Implemented Interfaces:
NamingScheme
public class SimpleEnumeratingScheme extends java.lang.Object implements NamingScheme
Simple enumerating naming scheme. Cluster names are generated as follows:- if the cluster has a name assigned, use it
- otherwise use getNameAutomatic() as name, and add an enumeration postfix
- Since:
- 0.2
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private Clustering<?>
clustering
Clustering this scheme is applied to.private it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap<java.lang.String>
namefreq
Count how often each name occurred so far.private java.util.Map<Cluster<?>,java.lang.String>
names
Assigned cluster names.private static java.lang.String
NULLPOSTFIX
This is the postfix added to the first cluster, which will be removed when there is only one cluster of this name.
-
Constructor Summary
Constructors Constructor Description SimpleEnumeratingScheme(Clustering<?> clustering)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getNameFor(Cluster<?> cluster)
Retrieve the cluster name.private void
updateNames()
Assign names to each cluster (which doesn't have a name yet)
-
-
-
Field Detail
-
clustering
private Clustering<?> clustering
Clustering this scheme is applied to.
-
namefreq
private it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap<java.lang.String> namefreq
Count how often each name occurred so far.
-
names
private java.util.Map<Cluster<?>,java.lang.String> names
Assigned cluster names.
-
NULLPOSTFIX
private static final java.lang.String NULLPOSTFIX
This is the postfix added to the first cluster, which will be removed when there is only one cluster of this name.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SimpleEnumeratingScheme
public SimpleEnumeratingScheme(Clustering<?> clustering)
Constructor.- Parameters:
clustering
- Clustering result to name.
-
-
Method Detail
-
updateNames
private void updateNames()
Assign names to each cluster (which doesn't have a name yet)
-
getNameFor
public java.lang.String getNameFor(Cluster<?> cluster)
Retrieve the cluster name. When a name has not yet been assigned, callupdateNames()
- Specified by:
getNameFor
in interfaceNamingScheme
- Parameters:
cluster
- cluster to get a name for- Returns:
- cluster name
-
-