public class NominalAttribute extends Attribute
numValues
and values
can be
defined.
param: values optional values. At most one of numValues
and values
can be defined.Modifier and Type | Method and Description |
---|---|
AttributeType |
attrType()
Attribute type.
|
static NominalAttribute |
defaultAttr()
The default nominal attribute.
|
boolean |
equals(java.lang.Object other) |
scala.Option<java.lang.Object> |
getNumValues()
Get the number of values, either from
numValues or from values . |
java.lang.String |
getValue(int index)
Gets a value given its index.
|
int |
hashCode() |
boolean |
hasValue(java.lang.String value)
Tests whether this attribute contains a specific value.
|
scala.Option<java.lang.Object> |
index()
Index of the attribute.
|
int |
indexOf(java.lang.String value)
Index of a specific value.
|
boolean |
isNominal()
Tests whether this attribute is nominal, true for
NominalAttribute and BinaryAttribute . |
boolean |
isNumeric()
Tests whether this attribute is numeric, true for
NumericAttribute and BinaryAttribute . |
scala.Option<java.lang.Object> |
isOrdinal() |
scala.Option<java.lang.String> |
name()
Name of the attribute.
|
scala.Option<java.lang.Object> |
numValues() |
static Metadata |
toMetadata() |
static Metadata |
toMetadata(Metadata existingMetadata) |
static java.lang.String |
toString() |
static StructField |
toStructField() |
static StructField |
toStructField(Metadata existingMetadata) |
scala.Option<java.lang.String[]> |
values() |
NominalAttribute |
withIndex(int index)
Copy with a new index.
|
NominalAttribute |
withName(java.lang.String name)
Copy with a new name.
|
NominalAttribute |
withNumValues(int numValues)
Copy with a new `numValues` and empty `values`.
|
NominalAttribute |
withoutIndex()
Copy without the index.
|
NominalAttribute |
withoutName()
Copy without the name.
|
NominalAttribute |
withoutNumValues()
Copy without the `numValues`.
|
NominalAttribute |
withoutValues()
Copy without the values.
|
NominalAttribute |
withValues(java.lang.String[] values)
Copy with new values and empty `numValues`.
|
NominalAttribute |
withValues(java.lang.String first,
scala.collection.Seq<java.lang.String> others)
Copy with new values and empty `numValues`.
|
NominalAttribute |
withValues(java.lang.String first,
java.lang.String... others)
Copy with new values and empty `numValues`.
|
toMetadata, toMetadata, toString, toStructField, toStructField
public static final NominalAttribute defaultAttr()
public static Metadata toMetadata()
public static StructField toStructField(Metadata existingMetadata)
public static StructField toStructField()
public static java.lang.String toString()
public NominalAttribute withValues(java.lang.String first, java.lang.String... others)
public scala.Option<java.lang.String> name()
Attribute
public scala.Option<java.lang.Object> index()
Attribute
public scala.Option<java.lang.Object> isOrdinal()
public scala.Option<java.lang.Object> numValues()
public scala.Option<java.lang.String[]> values()
public AttributeType attrType()
Attribute
public boolean isNumeric()
Attribute
NumericAttribute
and BinaryAttribute
.public boolean isNominal()
Attribute
NominalAttribute
and BinaryAttribute
.public int indexOf(java.lang.String value)
public boolean hasValue(java.lang.String value)
public java.lang.String getValue(int index)
public NominalAttribute withName(java.lang.String name)
Attribute
public NominalAttribute withoutName()
Attribute
withoutName
in class Attribute
public NominalAttribute withIndex(int index)
Attribute
public NominalAttribute withoutIndex()
Attribute
withoutIndex
in class Attribute
public NominalAttribute withValues(java.lang.String[] values)
public NominalAttribute withValues(java.lang.String first, scala.collection.Seq<java.lang.String> others)
public NominalAttribute withoutValues()
public NominalAttribute withNumValues(int numValues)
public NominalAttribute withoutNumValues()
public scala.Option<java.lang.Object> getNumValues()
numValues
or from values
.
Return None if unknown.public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object