
M - Model object typepublic class Cluster<M extends Model> extends Object implements Hierarchical<Cluster<M>>, TextWriteable
| Modifier and Type | Class and Description |
|---|---|
static class |
Cluster.PartialComparator
A partial comparator for Clusters, based on their name.
|
| Modifier and Type | Field and Description |
|---|---|
private Hierarchy<Cluster<M>> |
hierarchy
Object that the hierarchy management is delegated to.
|
private DBIDs |
ids
Cluster data.
|
private M |
model
Cluster model.
|
protected String |
name
Cluster name.
|
private boolean |
noise
Noise?
|
| Constructor and Description |
|---|
Cluster(DBIDs ids)
Constructor without hierarchy information and name and model
|
Cluster(DBIDs ids,
boolean noise)
Constructor without hierarchy information and name and model
|
Cluster(DBIDs ids,
boolean noise,
M model)
Constructor without hierarchy information and name
|
Cluster(DBIDs ids,
M model)
Constructor without hierarchy information and name
|
Cluster(String name,
DBIDs ids)
Constructor without hierarchy information and model
|
Cluster(String name,
DBIDs ids,
boolean noise)
Constructor without hierarchy information and model
|
Cluster(String name,
DBIDs ids,
boolean noise,
M model)
Constructor without hierarchy information.
|
Cluster(String name,
DBIDs ids,
boolean noise,
M model,
Hierarchy<Cluster<M>> hierarchy)
Full constructor
|
Cluster(String name,
DBIDs ids,
boolean noise,
M model,
List<Cluster<M>> children,
List<Cluster<M>> parents)
Constructor with hierarchy information.
|
Cluster(String name,
DBIDs ids,
M model)
Constructor without hierarchy information.
|
Cluster(String name,
DBIDs ids,
M model,
Hierarchy<Cluster<M>> hierarchy)
Constructor with hierarchy but noise flag defaulting to false.
|
Cluster(String name,
DBIDs ids,
M model,
List<Cluster<M>> children,
List<Cluster<M>> parents)
Constructor with hierarchy information, but no noise flag.
|
| Modifier and Type | Method and Description |
|---|---|
List<Cluster<M>> |
getChildren()
Delegate to hierarchy object
|
Set<Cluster<M>> |
getDescendants()
Collect descendants
|
Hierarchy<Cluster<M>> |
getHierarchy()
Get hierarchy object
|
DBIDs |
getIDs()
Access group object
|
M |
getModel()
Access model object
|
String |
getName()
Get Cluster name.
|
String |
getNameAutomatic()
Return either the assigned name or the suggested label
|
List<Cluster<M>> |
getParents()
Delegate to hierarchy object
|
boolean |
isHierarchical()
Test hierarchy
|
boolean |
isNoise()
Getter for noise flag.
|
IterableIterator<Cluster<M>> |
iterAncestors()
Delegate to hierarchy object
|
IterableIterator<Cluster<M>> |
iterDescendants()
Delegate to hierarchy object
|
int |
numChildren()
Delegate to hierarchy object
|
int |
numParents()
Delegate to hierarchy object
|
void |
setHierarchy(Hierarchy<Cluster<M>> hierarchy)
Set hierarchy object
|
void |
setIDs(DBIDs g)
Access group object
|
void |
setModel(M model)
Access model object
|
void |
setName(String name)
Set Cluster name
|
void |
setNoise(boolean noise)
Setter for noise flag.
|
int |
size()
Delegate to database object group.
|
String |
toString() |
void |
writeToText(TextWriterStream out,
String label)
Write to a textual representation.
|
private Hierarchy<Cluster<M extends Model>> hierarchy
protected String name
private DBIDs ids
private boolean noise
public Cluster(String name, DBIDs ids, boolean noise, M model, Hierarchy<Cluster<M>> hierarchy)
name - Cluster name. May be null.ids - Object Groupnoise - Noise flagmodel - Model. May be null.hierarchy - Hierarchy object. May be null.public Cluster(String name, DBIDs ids, boolean noise, M model, List<Cluster<M>> children, List<Cluster<M>> parents)
name - Cluster name. May be null.ids - Object Groupnoise - Noise flagmodel - Model. May be null.children - Children. Will NOT be copied.parents - Parents. Will NOT be copied.public Cluster(String name, DBIDs ids, boolean noise, M model)
name - Cluster name. May be null.ids - Object groupnoise - Noise flagmodel - Modelpublic Cluster(String name, DBIDs ids, M model)
name - Cluster name. May be null.ids - Object groupmodel - Modelpublic Cluster(DBIDs ids, boolean noise, M model)
ids - Object groupnoise - Noise flagmodel - Modelpublic Cluster(DBIDs ids, M model)
ids - Object groupmodel - Modelpublic Cluster(String name, DBIDs ids, boolean noise)
name - Cluster name. May be null.ids - Object groupnoise - Noise flagpublic Cluster(String name, DBIDs ids)
name - Cluster name. May be null.ids - Object grouppublic Cluster(DBIDs ids, boolean noise)
ids - Cluster name. May be null.noise - Noise flagpublic Cluster(DBIDs ids)
ids - Object grouppublic Cluster(String name, DBIDs ids, M model, Hierarchy<Cluster<M>> hierarchy)
name - Cluster name. May be null.ids - Object groupmodel - Model. May be null.hierarchy - Hierarchy object. May be null.public Cluster(String name, DBIDs ids, M model, List<Cluster<M>> children, List<Cluster<M>> parents)
name - Cluster name. May be null.ids - Object Groupmodel - Model. May be null.children - Children. Will NOT be copied.parents - Parents. Will NOT be copied.public final boolean isHierarchical()
isHierarchical in interface Hierarchical<Cluster<M extends Model>>public int numChildren()
numChildren in interface Hierarchical<Cluster<M extends Model>>public List<Cluster<M>> getChildren()
getChildren in interface Hierarchical<Cluster<M extends Model>>public IterableIterator<Cluster<M>> iterDescendants()
iterDescendants in interface Hierarchical<Cluster<M extends Model>>public Set<Cluster<M>> getDescendants()
public int numParents()
numParents in interface Hierarchical<Cluster<M extends Model>>public List<Cluster<M>> getParents()
getParents in interface Hierarchical<Cluster<M extends Model>>public IterableIterator<Cluster<M>> iterAncestors()
iterAncestors in interface Hierarchical<Cluster<M extends Model>>public int size()
public Hierarchy<Cluster<M>> getHierarchy()
public void setHierarchy(Hierarchy<Cluster<M>> hierarchy)
hierarchy - new hierarchy objectpublic String getNameAutomatic()
public String getName()
public void setName(String name)
name - new cluster namepublic DBIDs getIDs()
public void setIDs(DBIDs g)
g - set database object grouppublic M getModel()
public void setModel(M model)
model - New cluster modelpublic void writeToText(TextWriterStream out, String label)
writeToText in interface TextWriteableout - output writer streamlabel - Label to prefixpublic boolean isNoise()
public void setNoise(boolean noise)
noise - new noise flag value