Class Segment
- java.lang.Object
-
- elki.evaluation.clustering.pairsegments.Segment
-
- All Implemented Interfaces:
java.lang.Comparable<Segment>
public class Segment extends java.lang.Object implements java.lang.Comparable<Segment>
A segment represents a set of pairs that share the same clustering properties.As such, for each ring (= clustering), a cluster number (or the constant
UNCLUSTERED) is stored.- Since:
- 0.5.0
- Author:
- Sascha Goldhofer, Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]clusterIdsThe cluster numbers in each ringprotected DBIDsobjIDsIDs in segment, for object segments.protected longpairsizeSize of cluster, in pairs.static intUNCLUSTEREDObject is not clustered
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Segment sid)booleanequals(java.lang.Object obj)intget(int idx)Get cluster number for index idx.DBIDsgetDBIDs()Get the DBIDs of objects contained in this segment.longgetPairCount()Get the number of pairs in the segment.intgetUnpairedClusteringIndex()Returns the index of the first clustering having an unpaired cluster, or -1 no unpaired cluster exists.inthashCode()booleanisNone()Check if this segment contains the pairs that are never clustered by any of the clusterings (all 0).booleanisUnpaired()Checks if the segment has a cluster with unpaired objects.
-
-
-
Field Detail
-
UNCLUSTERED
public static final int UNCLUSTERED
Object is not clustered- See Also:
- Constant Field Values
-
objIDs
protected DBIDs objIDs
IDs in segment, for object segments.
-
pairsize
protected long pairsize
Size of cluster, in pairs.
-
clusterIds
protected final int[] clusterIds
The cluster numbers in each ring
-
-
Method Detail
-
getPairCount
public long getPairCount()
Get the number of pairs in the segment.- Returns:
- Number of pairs
-
get
public int get(int idx)
Get cluster number for index idx.- Parameters:
idx- Index- Returns:
- Cluster number
-
isUnpaired
public boolean isUnpaired()
Checks if the segment has a cluster with unpaired objects. Unpaired clusters are represented by "0" (0 = all).- Returns:
- true when unclustered in at least one dimension.
-
isNone
public boolean isNone()
Check if this segment contains the pairs that are never clustered by any of the clusterings (all 0).- Returns:
- true when unclustered everywhere
-
getUnpairedClusteringIndex
public int getUnpairedClusteringIndex()
Returns the index of the first clustering having an unpaired cluster, or -1 no unpaired cluster exists.- Returns:
- clustering id or -1
-
getDBIDs
public DBIDs getDBIDs()
Get the DBIDs of objects contained in this segment.- Returns:
- the segment IDs
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-