Class AddUserFields.AttributeSpec
- java.lang.Object
-
- weka.filters.unsupervised.attribute.AddUserFields.AttributeSpec
-
- All Implemented Interfaces:
Serializable
- Enclosing class:
- AddUserFields
public static class AddUserFields.AttributeSpec extends Object implements Serializable
Inner class encapsulating a new user-specified attribute to create.- Author:
- Mark Hall (mhall{[at]}pentaho{[dot]}com)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AttributeSpec()Default constructorAttributeSpec(String spec)Constructor that takes an attribute specification in internal format
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDateFormat()Get the date formatting string (if any)DategetDateValue()Get the value of the attribute as a date or null if the attribute isn't of type date.StringgetName()Get the name of the new attributeStringgetNominalOrStringValue()Get the value of the attribute as a string (nominal and string attribute) or null if the attribute is not nominal or stringdoublegetNumericValue()Get the value of the attribute as a number or Utils.missingValue() if the attribute is not numeric.StringgetResolvedName()Get the name of the attribute after substituting any environment variablesStringgetResolvedType()Get the type of the attribute after substituting any environment variablesStringgetResolvedValue()Get the value of the attribute after substituting any environment variablesStringgetType()Get the type of the new attributeStringgetValue()Get the value of the new attribute.voidinit(Environment env)Initialize this attribute spec by resolving any environment variables and setting up the date format (if necessary)voidsetName(String name)Set the name of the new attributevoidsetType(String type)Set the type of the new attributevoidsetValue(String value)Set the value of the new attribute.StringtoString()Return a nicely formatted string for displayStringtoStringInternal()
-
-
-
Constructor Detail
-
AttributeSpec
public AttributeSpec()
Default constructor
-
AttributeSpec
public AttributeSpec(String spec)
Constructor that takes an attribute specification in internal format- Parameters:
spec- the attribute spec to use
-
-
Method Detail
-
setName
public void setName(String name)
Set the name of the new attribute- Parameters:
name- the name of the new attribute
-
getName
public String getName()
Get the name of the new attribute- Returns:
- the name of the new attribute
-
setType
public void setType(String type)
Set the type of the new attribute- Parameters:
type- the type of the new attribute
-
getType
public String getType()
Get the type of the new attribute- Returns:
- the type of the new attribute
-
setValue
public void setValue(String value)
Set the value of the new attribute. Date attributes can assume a supplied date value (parseable by either the default date format or a user specified one) or the current time stamp if the user specifies the special string "now".- Parameters:
value- the value of the new attribute
-
getValue
public String getValue()
Get the value of the new attribute. Date attributes can assume a supplied date value (parseable by either the default date format or a user specified one) or the current time stamp if the user specifies the special string "now".- Returns:
- the value of the new attribute
-
getResolvedName
public String getResolvedName()
Get the name of the attribute after substituting any environment variables- Returns:
- the name of the attribute after environment variables have been substituted
-
getResolvedValue
public String getResolvedValue()
Get the value of the attribute after substituting any environment variables- Returns:
- the value of the attribute after environment variables have been substituted
-
getResolvedType
public String getResolvedType()
Get the type of the attribute after substituting any environment variables- Returns:
- the tyep of the attribute after environment variables have been substituted
-
getDateFormat
public String getDateFormat()
Get the date formatting string (if any)- Returns:
- the date formatting string
-
getDateValue
public Date getDateValue()
Get the value of the attribute as a date or null if the attribute isn't of type date.- Returns:
- the value as a date
-
getNumericValue
public double getNumericValue()
Get the value of the attribute as a number or Utils.missingValue() if the attribute is not numeric.- Returns:
- the value of the attribute as a number
-
getNominalOrStringValue
public String getNominalOrStringValue()
Get the value of the attribute as a string (nominal and string attribute) or null if the attribute is not nominal or string- Returns:
- the value of the attribute as a string
-
init
public void init(Environment env)
Initialize this attribute spec by resolving any environment variables and setting up the date format (if necessary)- Parameters:
env- environment variables to use
-
toString
public String toString()
Return a nicely formatted string for display
-
toStringInternal
public String toStringInternal()
-
-