public class AddUserFields extends Filter implements OptionHandler, EnvironmentHandler, UnsupervisedFilter, WeightedInstancesHandler, WeightedAttributesHandler
-A <name:type:value> New field specification (name@type@value). Environment variables may be used for any/all parts of the specification. Type can be one of (numeric, nominal, string or date). The value for date be a specific date string or the special string "now" to indicate the current date-time. A specific date format string for parsing specific date values can be specified by suffixing the type specification - e.g. "myTime@date:MM-dd-yyyy@08-23-2009".This option may be specified multiple times
| Modifier and Type | Class and Description |
|---|---|
static class |
AddUserFields.AttributeSpec
Inner class encapsulating a new user-specified attribute to create.
|
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<AddUserFields.AttributeSpec> |
m_attributeSpecs
The new attributes to create
|
protected Environment |
m_env |
m_Debug, m_DoNotCheckCapabilities, m_FirstBatchDone, m_InputRelAtts, m_InputStringAtts, m_NewBatch, m_OutputRelAtts, m_OutputStringAtts| Constructor and Description |
|---|
AddUserFields()
Constructs a new AddUserFields
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttributeSpec(java.lang.String spec)
Add an attribute spec to the list
|
java.lang.String |
attributeSpecsTipText()
Returns the tip text for this property.
|
void |
clearAttributeSpecs()
Clear the list of attribute specifications
|
protected void |
convertInstance(Instance instance)
Add the new attribute values to an instance
|
java.util.List<AddUserFields.AttributeSpec> |
getAttributeSpecs()
Get the list of attribute specs to use to create the new attributes.
|
Capabilities |
getCapabilities()
Returns the Capabilities of this filter.
|
java.lang.String[] |
getOptions()
Gets the current settings of the filter
|
java.lang.String |
globalInfo()
Returns a string describing this filter
|
boolean |
input(Instance instance)
Input an instance for filtering.
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(java.lang.String[] argv)
Main method for testing this class.
|
void |
setAttributeSpecs(java.util.List<AddUserFields.AttributeSpec> specs)
Set the list of attribute specs to use to create the new attributes.
|
void |
setEnvironment(Environment env)
Set environment varialbes to use
|
boolean |
setInputFormat(Instances instanceInfo)
Sets the format of the input instances.
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
protected void |
setOutputFormat()
Create and set the output format
|
batchFilterFile, batchFinished, bufferInput, copyValues, copyValues, debugTipText, doNotCheckCapabilitiesTipText, filterFile, flushInput, getCapabilities, getCopyOfInputFormat, getDebug, getDoNotCheckCapabilities, getInputFormat, getOutputFormat, getRevision, initInputLocators, initOutputLocators, inputFormatPeek, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, mayRemoveInstanceAfterFirstBatchDone, numPendingOutput, output, outputFormatPeek, outputPeek, postExecution, preExecution, push, push, resetQueue, run, runFilter, setDebug, setDoNotCheckCapabilities, setOutputFormat, testInputFormat, toString, useFilter, wekaStaticWrapperprotected java.util.List<AddUserFields.AttributeSpec> m_attributeSpecs
protected transient Environment m_env
public java.lang.String globalInfo()
public Capabilities getCapabilities()
getCapabilities in interface CapabilitiesHandlergetCapabilities in class FilterCapabilitiespublic void clearAttributeSpecs()
public java.util.Enumeration<Option> listOptions()
listOptions in interface OptionHandlerlistOptions in class Filterpublic void setOptions(java.lang.String[] options)
throws java.lang.Exception
-A <name:type:value> * New field specification (name@type@value). * Environment variables may be used for any/all parts of the * specification. Type can be one of (numeric, nominal, string or date). * The value for date be a specific date string or the special string * "now" to indicate the current date-time. A specific date format * string for parsing specific date values can be specified by suffixing * the type specification - e.g. "myTime@date:MM-dd-yyyy@08-23-2009".This option may be specified multiple times*
setOptions in interface OptionHandlersetOptions in class Filteroptions - the list of options as an array of stringjava.lang.Exception - if an option is not supportedpublic java.lang.String[] getOptions()
getOptions in interface OptionHandlergetOptions in class Filterpublic void addAttributeSpec(java.lang.String spec)
spec - the attribute spec to addpublic java.lang.String attributeSpecsTipText()
public void setAttributeSpecs(java.util.List<AddUserFields.AttributeSpec> specs)
specs - the list of attribute specs to usepublic java.util.List<AddUserFields.AttributeSpec> getAttributeSpecs()
public void setEnvironment(Environment env)
setEnvironment in interface EnvironmentHandlerenv - the environment variables to usepublic boolean setInputFormat(Instances instanceInfo) throws java.lang.Exception
setInputFormat in class FilterinstanceInfo - an Instances object containing the input instance
structure (any instances contained in the object are ignored -
only the structure is required).java.lang.Exception - if the input format can't be set successfullypublic boolean input(Instance instance)
protected void convertInstance(Instance instance)
instance - the instance to processprotected void setOutputFormat()
public static void main(java.lang.String[] argv)
argv - should contain arguments to the filter: use -h for help