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(Object other) |
static Attribute |
fromStructField(StructField field) |
scala.Option<Object> |
getNumValues()
Get the number of values, either from
numValues or from values. |
String |
getValue(int index)
Gets a value given its index.
|
int |
hashCode() |
boolean |
hasValue(String value)
Tests whether this attribute contains a specific value.
|
scala.Option<Object> |
index()
Index of the attribute.
|
int |
indexOf(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<Object> |
isOrdinal() |
scala.Option<String> |
name()
Name of the attribute.
|
scala.Option<Object> |
numValues() |
scala.Option<String[]> |
values() |
NominalAttribute |
withIndex(int index)
Copy with a new index.
|
NominalAttribute |
withName(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(String[] values)
Copy with new values and empty
numValues. |
NominalAttribute |
withValues(String first,
scala.collection.Seq<String> others)
Copy with new values and empty
numValues. |
NominalAttribute |
withValues(String first,
String... others)
Copy with new values and empty
numValues. |
toMetadata, toMetadata, toString, toStructField, toStructFieldpublic static final NominalAttribute defaultAttr()
public static Attribute fromStructField(StructField field)
public NominalAttribute withValues(String first, String... others)
numValues.first - (undocumented)others - (undocumented)public scala.Option<String> name()
Attributepublic scala.Option<Object> index()
Attributepublic scala.Option<Object> isOrdinal()
public scala.Option<Object> numValues()
public scala.Option<String[]> values()
public AttributeType attrType()
Attributepublic boolean isNumeric()
AttributeNumericAttribute and BinaryAttribute.public boolean isNominal()
AttributeNominalAttribute and BinaryAttribute.public int indexOf(String value)
public boolean hasValue(String value)
public String getValue(int index)
public NominalAttribute withName(String name)
Attributepublic NominalAttribute withoutName()
AttributewithoutName in class Attributepublic NominalAttribute withIndex(int index)
Attributepublic NominalAttribute withoutIndex()
AttributewithoutIndex in class Attributepublic NominalAttribute withValues(String[] values)
numValues.values - (undocumented)public NominalAttribute withValues(String first, scala.collection.Seq<String> others)
numValues.first - (undocumented)others - (undocumented)public NominalAttribute withoutValues()
public NominalAttribute withNumValues(int numValues)
numValues and empty values.numValues - (undocumented)public NominalAttribute withoutNumValues()
numValues.public scala.Option<Object> getNumValues()
numValues or from values.
Return None if unknown.public boolean equals(Object other)
equals in class Objectpublic int hashCode()
hashCode in class Object