|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.data.ClassLabel de.lmu.ifi.dbs.elki.data.HierarchicalClassLabel
public class HierarchicalClassLabel
A HierarchicalClassLabel is a ClassLabel to reflect a hierarchical structure of classes.
Nested Class Summary | |
---|---|
static class |
HierarchicalClassLabel.Factory
Factory class |
Field Summary | |
---|---|
static Pattern |
DEFAULT_SEPARATOR
The default separator pattern, a point ('.'). |
static String |
DEFAULT_SEPARATOR_STRING
The default separator, a point ('.'). |
private Comparable<?>[] |
levelwiseNames
Holds the names on the different levels. |
private Pattern |
separatorPattern
Holds the Pattern to separate different levels parsing input. |
private String |
separatorString
A String to separate different levels in a String representation of this HierarchicalClassLabel. |
Constructor Summary | |
---|---|
HierarchicalClassLabel(String label)
Constructs a hierarchical class label from the given name. |
|
HierarchicalClassLabel(String name,
Pattern regex,
String separator)
Constructs a hierarchical class label from the given name, using the given Pattern to match separators of different levels in the given name, and setting the given separator-String to separate different levels in String representations of this HierarchicalClassLabel. |
Method Summary | |
---|---|
int |
compareTo(ClassLabel o)
Compares two HierarchicalClassLabels. |
int |
depth()
The length of the hierarchy of names. |
String |
getNameAt(int level)
Returns the name at the given level as a String. |
String |
toString()
Returns a String representation of this HierarchicalClassLabel using separatorString to separate levels. |
String |
toString(int level)
Provides a String representation of this ClassLabel comprising only the first level levels. |
Methods inherited from class de.lmu.ifi.dbs.elki.data.ClassLabel |
---|
equals, hashCode |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Pattern DEFAULT_SEPARATOR
public static final String DEFAULT_SEPARATOR_STRING
private Pattern separatorPattern
private String separatorString
private Comparable<?>[] levelwiseNames
Constructor Detail |
---|
public HierarchicalClassLabel(String name, Pattern regex, String separator)
name
- a String describing a hierarchical class labelregex
- a Pattern to match separators of different levels in the given
nameseparator
- a separator String to separate different levels in the
String-representation of this HierarchicalClassLabelpublic HierarchicalClassLabel(String label)
DEFAULT_SEPARATOR
. Also, in a
String-representation of this HierarchicalClassLabel, different levels get
separated by '.'.
label
- a String describing a hierarchical class labelMethod Detail |
---|
public int compareTo(ClassLabel o)
public int depth()
public String getNameAt(int level)
level
- the level to return the name at
public String toString()
separatorString
to separate levels.
toString
in class ClassLabel
toString(int)
public String toString(int level)
level
levels.
level
- the lowest level to include in the String representation.
level
levels
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |