Package elki.data
Class SimpleClassLabel
- java.lang.Object
-
- elki.data.ClassLabel
-
- elki.data.SimpleClassLabel
-
- All Implemented Interfaces:
java.lang.Comparable<ClassLabel>
public class SimpleClassLabel extends ClassLabel
A simple class label casting a String as it is as label.- Since:
- 0.1
- Author:
- Arthur Zimek
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SimpleClassLabel.Factory
Factory class.static class
SimpleClassLabel.Serializer
Serialization class.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
label
Holds the String designating the label.static ByteBufferSerializer<SimpleClassLabel>
SERIALIZER
Serializer.static SimpleTypeInformation<SimpleClassLabel>
TYPE
Type information.
-
Constructor Summary
Constructors Constructor Description SimpleClassLabel(java.lang.String label)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(ClassLabel o)
boolean
equals(java.lang.Object o)
Any ClassLabel should ensure a natural ordering that is consistent with equals.int
hashCode()
Returns the hashCode of the String-representation of this ClassLabel.java.lang.String
toString()
Any ClassLabel requires a method to represent the label as a String.
-
-
-
Field Detail
-
SERIALIZER
public static final ByteBufferSerializer<SimpleClassLabel> SERIALIZER
Serializer.
-
TYPE
public static final SimpleTypeInformation<SimpleClassLabel> TYPE
Type information.
-
label
private java.lang.String label
Holds the String designating the label.
-
-
Method Detail
-
compareTo
public int compareTo(ClassLabel o)
-
hashCode
public int hashCode()
Description copied from class:ClassLabel
Returns the hashCode of the String-representation of this ClassLabel.- Overrides:
hashCode
in classClassLabel
-
equals
public boolean equals(java.lang.Object o)
Description copied from class:ClassLabel
Any ClassLabel should ensure a natural ordering that is consistent with equals. Thus, ifthis.compareTo(o)==0
, thenthis.equals(o)
should betrue
.- Overrides:
equals
in classClassLabel
- Parameters:
o
- an object to test for equality w.r.t. this ClassLabel- Returns:
- true, if
this==obj || this.compareTo(o)==0
, false otherwise
-
toString
public java.lang.String toString()
Description copied from class:ClassLabel
Any ClassLabel requires a method to represent the label as a String. IfClassLabel a.equals((ClassLabel) b)
, then alsoa.toString().equals(b.toString())
should hold.- Specified by:
toString
in classClassLabel
-
-