public class AddID extends Filter implements UnsupervisedFilter, OptionHandler
-C <index> Specify where to insert the ID. First and last are valid indexes.(default first)
-N <name> Name of the new attribute. (default = 'ID')
Modifier and Type | Field and Description |
---|---|
protected int |
m_Counter
the counter for the ID
|
protected SingleIndex |
m_Index
the index of the attribute
|
protected String |
m_Name
the name of the attribute
|
m_FirstBatchDone, m_InputRelAtts, m_InputStringAtts, m_NewBatch, m_OutputRelAtts, m_OutputStringAtts
Constructor and Description |
---|
AddID() |
Modifier and Type | Method and Description |
---|---|
String |
attributeNameTipText()
Returns the tip text for this property
|
boolean |
batchFinished()
Signify that this batch of input to the filter is finished.
|
protected void |
convertInstance(Instance instance)
Convert a single instance over.
|
String |
getAttributeName()
Get the name of the attribute to be created
|
Capabilities |
getCapabilities()
Returns the Capabilities of this filter.
|
String |
getIDIndex()
Get the index of the attribute used.
|
String[] |
getOptions()
Gets the current settings of the filter.
|
String |
getRevision()
Returns the revision string.
|
String |
globalInfo()
Returns a string describing this filter
|
String |
IDIndexTipText()
Returns the tip text for this property
|
boolean |
input(Instance instance)
Input an instance for filtering.
|
Enumeration |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(String[] args)
Main method for testing this class.
|
void |
setAttributeName(String value)
Set the new attribute's name
|
void |
setIDIndex(String value)
Sets index of the attribute used.
|
boolean |
setInputFormat(Instances instanceInfo)
Sets the format of the input instances.
|
void |
setOptions(String[] options)
Parses a given list of options.
|
batchFilterFile, bufferInput, copyValues, copyValues, filterFile, flushInput, getCapabilities, getInputFormat, getOutputFormat, initInputLocators, initOutputLocators, inputFormatPeek, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, numPendingOutput, output, outputFormatPeek, outputPeek, push, resetQueue, runFilter, setOutputFormat, testInputFormat, toString, useFilter, wekaStaticWrapper
protected SingleIndex m_Index
protected String m_Name
protected int m_Counter
public String globalInfo()
public Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(String[] options) throws Exception
-C <index> Specify where to insert the ID. First and last are valid indexes.(default first)
-N <name> Name of the new attribute. (default = 'ID')
setOptions
in interface OptionHandler
options
- the list of options as an array of stringsException
- if an option is not supportedpublic String[] getOptions()
getOptions
in interface OptionHandler
public String attributeNameTipText()
public String getAttributeName()
public void setAttributeName(String value)
value
- the new namepublic String IDIndexTipText()
public String getIDIndex()
public void setIDIndex(String value)
value
- the index of the attributepublic Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class Filter
Capabilities
public boolean setInputFormat(Instances instanceInfo) throws Exception
setInputFormat
in class Filter
instanceInfo
- an Instances object containing the input instance
structure (any instances contained in the object are ignored - only the
structure is required).Exception
- if the format couldn't be set successfullypublic boolean input(Instance instance)
input
in class Filter
instance
- the input instanceIllegalStateException
- if no input format has been set.public boolean batchFinished()
batchFinished
in class Filter
IllegalStateException
- if no input structure has been definedprotected void convertInstance(Instance instance)
instance
- the instance to convertpublic String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class Filter
public static void main(String[] args)
args
- should contain arguments to the filter: use -h for helpCopyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.