public class NominalAttribute<T> extends Attribute<T>
Constructor and Description |
---|
NominalAttribute(String name,
Class<T> clazz,
List<S> values)
Creates a new
NominalAttribute . |
NominalAttribute(String name,
Class<T> clazz,
S... values)
Creates a new
NominalAttribute . |
Modifier and Type | Method and Description |
---|---|
protected void |
checkTypeCompatibility(Object value) |
String |
getARFFValues()
Returns the values supported by this attribute as ARFF string
|
int |
getIndexOf(Object value)
Returns the index of the passed value within the values represented by this class.
|
int |
getIndexOfValueAsString(String value)
Returns the index of the value within the values represented by this class where the string representation
of those values equals the given string
|
T |
getValueAt(int index)
Returns the value at the given index within the values of this attribute.
|
List<T> |
getValues()
Returns a list of the values supported by this attribute
|
boolean |
hasValue(Object value)
Returns true if the passed value is supported by this attribute (i.e. if it is part of the values defined by the constructor)
|
public NominalAttribute(String name, Class<T> clazz, List<S> values)
NominalAttribute
.name
- the name of this attributeclazz
- the class of the values represented by this attributevalues
- the possible values for objects represented by this attribute@SafeVarargs public NominalAttribute(String name, Class<T> clazz, S... values)
NominalAttribute
.name
- the name of this attributeclazz
- the class of the values represented by this attributevalues
- the possible values for objects represented by this attributepublic String getARFFValues()
Attribute
getARFFValues
in class Attribute<T>
public T getValueAt(int index)
index
- the index of the wanted valuepublic boolean hasValue(Object value)
value
- the requested valueClassCastException
- if the type of the specified element is incompatible with this attributepublic int getIndexOf(Object value)
value
- the requested valueClassCastException
- if the type of the specified element is incompatible with this attributeprotected void checkTypeCompatibility(Object value)
public int getIndexOfValueAsString(String value)
value
- the string representation of the requested value@enterprise 10.0.39049 Copyright © 2024 FREQUENTIS AG. All Rights Reserved.