|
Carrot2 v3.5.2
API Documentation |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.carrot2.core.ClusterWithParent
public final class ClusterWithParent
Wraps a Cluster to add information about the cluster's parent cluster, if any.
A reference to the parent cluster is not kept directly in the Cluster class
because some algorithms may attach a single cluster to many parent clusters.
Instances of this class override hashCode() and equals(Object) by
forwarding them to cluster.
| Field Summary | |
|---|---|
Cluster |
cluster
The cluster wrapped by this class |
ClusterWithParent |
parent
The parent cluster of cluster, may be null in case of
top-level clusters. |
List<ClusterWithParent> |
subclusters
Subclusters of cluster wrapped to add their parent cluster. |
| Method Summary | |
|---|---|
boolean |
equals(Object obj)
|
static ClusterWithParent |
find(int id,
Collection<ClusterWithParent> wrappers)
Locate the first cluster that has id equal to id. |
int |
hashCode()
|
static ClusterWithParent |
wrap(Cluster root)
Wraps a cluster hierarchy starting with the root into
ClusterWithParent objects. |
static List<ClusterWithParent> |
wrap(List<Cluster> clusters)
Wraps a list of top level clusters. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final Cluster cluster
public final ClusterWithParent parent
cluster, may be null in case of
top-level clusters.
public final List<ClusterWithParent> subclusters
cluster wrapped to add their parent cluster. The list is
unmodifiable.
| Method Detail |
|---|
public static ClusterWithParent wrap(Cluster root)
root into
ClusterWithParent objects. All children of the root cluster
will have the parent field set to the wrapper corresponding to their
parent clusters, while for the root cluster, parent will be
null. Note that for efficiency reasons, reference cycles are
not detected.
root - the cluster to be wrapped
public static List<ClusterWithParent> wrap(List<Cluster> clusters)
null parent cluster. Note that for efficiency reasons,
reference cycles are not detected.
clusters - the list of top-level clusters to be wrapped
public static ClusterWithParent find(int id,
Collection<ClusterWithParent> wrappers)
id. The search
includes all the clusters in the input and their sub-clusters. The
first cluster with matching identifier is returned or null
if no such cluster could be found.
public int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Object
|
Please refer to project documentation at
http://project.carrot2.org |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||