|
|
|||||||||||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.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.
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()
|
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. |
void |
init(String label)
Constructs a hierarchical class label from the given name. |
void |
init(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. |
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()
ClassLabel.ClassLabel()
Method Detail |
---|
public void init(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 void init(String label)
DEFAULT_SEPARATOR
. Also, in a
String-representation of this HierarchicalClassLabel, different levels
get separated by '.'.
init
in class ClassLabel
label
- a String describing a hierarchical class labelinit(String, java.util.regex.Pattern, String)
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 |