Package com.yahoo.labs.samoa.instances
Class Attribute
- java.lang.Object
-
- com.yahoo.labs.samoa.instances.Attribute
-
- All Implemented Interfaces:
Serializable
public class Attribute extends Object implements Serializable
The Class Attribute.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
ARFF_ATTRIBUTE
The keyword used to denote the start of an arff attribute declarationstatic String
ARFF_ATTRIBUTE_DATE
The keyword used to denote a date attributestatic String
ARFF_ATTRIBUTE_INTEGER
A keyword used to denote a numeric attributestatic String
ARFF_ATTRIBUTE_NUMERIC
A keyword used to denote a numeric attributestatic String
ARFF_ATTRIBUTE_REAL
A keyword used to denote a numeric attributestatic String
ARFF_ATTRIBUTE_RELATIONAL
The keyword used to denote a relation-valued attributestatic String
ARFF_ATTRIBUTE_STRING
The keyword used to denote a string attributestatic String
ARFF_END_SUBRELATION
The keyword used to denote the end of the declaration of a subrelationprotected List<String>
attributeValues
The attribute values.protected boolean
isDate
The is date.protected boolean
isNominal
The is nominal.protected boolean
isNumeric
The is numeric.protected SimpleDateFormat
m_DateFormat
Date format specification for date attributesprotected String
name
The name.
-
Constructor Summary
Constructors Constructor Description Attribute()
Instantiates a new attribute.Attribute(String string)
Instantiates a new attribute.Attribute(String attributeName, String dateFormat)
Instantiates a new attribute.Attribute(String attributeName, List<String> attributeValues)
Instantiates a new attribute.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Enumeration
enumerateValues()
Returns an enumeration of all the attribute's values if the attribute is nominal, null otherwise.List<String>
getAttributeValues()
Gets the attribute values.int
indexOfValue(String value)
Index of value.boolean
isNominal()
Checks if is nominal.boolean
isNumeric()
Checks if is numeric.String
name()
Name.int
numValues()
Num values.String
toString()
Returns a description of this attribute in ARFF format.String
value(int value)
Value.
-
-
-
Field Detail
-
ARFF_ATTRIBUTE
public static final String ARFF_ATTRIBUTE
The keyword used to denote the start of an arff attribute declaration- See Also:
- Constant Field Values
-
ARFF_ATTRIBUTE_INTEGER
public static final String ARFF_ATTRIBUTE_INTEGER
A keyword used to denote a numeric attribute- See Also:
- Constant Field Values
-
ARFF_ATTRIBUTE_REAL
public static final String ARFF_ATTRIBUTE_REAL
A keyword used to denote a numeric attribute- See Also:
- Constant Field Values
-
ARFF_ATTRIBUTE_NUMERIC
public static final String ARFF_ATTRIBUTE_NUMERIC
A keyword used to denote a numeric attribute- See Also:
- Constant Field Values
-
ARFF_ATTRIBUTE_STRING
public static final String ARFF_ATTRIBUTE_STRING
The keyword used to denote a string attribute- See Also:
- Constant Field Values
-
ARFF_ATTRIBUTE_DATE
public static final String ARFF_ATTRIBUTE_DATE
The keyword used to denote a date attribute- See Also:
- Constant Field Values
-
ARFF_ATTRIBUTE_RELATIONAL
public static final String ARFF_ATTRIBUTE_RELATIONAL
The keyword used to denote a relation-valued attribute- See Also:
- Constant Field Values
-
ARFF_END_SUBRELATION
public static final String ARFF_END_SUBRELATION
The keyword used to denote the end of the declaration of a subrelation- See Also:
- Constant Field Values
-
isNominal
protected boolean isNominal
The is nominal.
-
isNumeric
protected boolean isNumeric
The is numeric.
-
isDate
protected boolean isDate
The is date.
-
m_DateFormat
protected SimpleDateFormat m_DateFormat
Date format specification for date attributes
-
name
protected String name
The name.
-
-
Constructor Detail
-
Attribute
public Attribute(String string)
Instantiates a new attribute.- Parameters:
string
- the string
-
Attribute
public Attribute(String attributeName, List<String> attributeValues)
Instantiates a new attribute.- Parameters:
attributeName
- the attribute nameattributeValues
- the attribute values
-
Attribute
public Attribute(String attributeName, String dateFormat)
Instantiates a new attribute.- Parameters:
attributeName
- the attribute namedateFormat
- the format of the date used
-
Attribute
public Attribute()
Instantiates a new attribute.
-
-
Method Detail
-
getAttributeValues
public List<String> getAttributeValues()
Gets the attribute values.- Returns:
- the attribute values
-
isNominal
public boolean isNominal()
Checks if is nominal.- Returns:
- true, if is nominal
-
name
public String name()
Name.- Returns:
- the string
-
value
public String value(int value)
Value.- Parameters:
value
- the value- Returns:
- the string
-
isNumeric
public boolean isNumeric()
Checks if is numeric.- Returns:
- true, if is numeric
-
numValues
public int numValues()
Num values.- Returns:
- the int
-
indexOfValue
public final int indexOfValue(String value)
Index of value.- Parameters:
value
- the value- Returns:
- the int
-
toString
public final String toString()
Returns a description of this attribute in ARFF format. Quotes strings if they contain whitespace characters, or if they are a question mark.
-
enumerateValues
public final Enumeration enumerateValues()
Returns an enumeration of all the attribute's values if the attribute is nominal, null otherwise.- Returns:
- enumeration of all the attribute's values
-
-