Package weka.knowledgeflow.steps
Class Sorter
- java.lang.Object
-
- weka.knowledgeflow.steps.BaseStep
-
- weka.knowledgeflow.steps.Sorter
-
- All Implemented Interfaces:
java.io.Serializable,BaseStepExtender,Step
@KFStep(name="Sorter", category="Tools", toolTipText="Sort instances in ascending or descending order according to the values of user-specified attributes. Instances can be sorted according to multiple attributes (defined in order). Handles datasets larger than can be fit into main memory via instance connections and specifying the in-memory buffer size. Implements a merge-sort by writing the sorted in-memory buffer to a file when full and then interleaving instances from the disk-based file(s) when the incoming stream has finished.", iconPath="weka/gui/knowledgeflow/icons/Sorter.gif") public class Sorter extends BaseStep
Step for sorting instances according to one or more attributes.- Version:
- $Revision: $
- Author:
- Mark Hall (mhall{[at]}pentaho{[dot]}com)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSorter.SortRuleImplements a sorting rule based on a single attribute
-
Constructor Summary
Constructors Constructor Description Sorter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetBufferSize()Get the size of the in-memory bufferjava.lang.StringgetCustomEditorForStep()Return the fully qualified name of a custom editor component (JComponent) to use for editing the properties of the step.java.util.List<java.lang.String>getIncomingConnectionTypes()Get a list of incoming connection types that this step can accept.java.util.List<java.lang.String>getOutgoingConnectionTypes()Get a list of outgoing connection types that this step can produce.java.lang.StringgetSortDetails()Get the sort rules to usejava.io.FilegetTempDirectory()Get the directory to use for temporary files during incremental operationvoidprocessIncoming(Data data)Process an incoming data payload (if the step accepts incoming connections)voidsetBufferSize(java.lang.String buffSize)Set the size of the in-memory buffervoidsetSortDetails(java.lang.String sortDetails)Set the sort rules to usevoidsetTempDirectory(java.io.File tempDir)Set the directory to use for temporary files during incremental operationvoidstepInit()Initialize the step.-
Methods inherited from class weka.knowledgeflow.steps.BaseStep
environmentSubstitute, getDefaultSettings, getInteractiveViewers, getInteractiveViewersImpls, getName, getStepManager, globalInfo, isResourceIntensive, isStopRequested, outputStructureForConnectionType, outputStructureForConnectionType, setName, setStepIsResourceIntensive, setStepManager, setStepMustRunSingleThreaded, start, stepMustRunSingleThreaded, stop
-
-
-
-
Method Detail
-
getBufferSize
public java.lang.String getBufferSize()
Get the size of the in-memory buffer- Returns:
- the size of the in-memory buffer
-
setBufferSize
@OptionMetadata(displayName="Size of in-mem streaming buffer", description="Number of instances to sort in memory before writing to a temp file (instance connections only)", displayOrder=1) public void setBufferSize(java.lang.String buffSize)
Set the size of the in-memory buffer- Parameters:
buffSize- the size of the in-memory buffer
-
setTempDirectory
@FilePropertyMetadata(fileChooserDialogType=0, directoriesOnly=true) @OptionMetadata(displayName="Directory for temp files", description="Where to store temporary files when spilling to disk", displayOrder=2) public void setTempDirectory(java.io.File tempDir)
Set the directory to use for temporary files during incremental operation- Parameters:
tempDir- the temp dir to use
-
getTempDirectory
public java.io.File getTempDirectory()
Get the directory to use for temporary files during incremental operation- Returns:
- the temp dir to use
-
setSortDetails
@ProgrammaticProperty public void setSortDetails(java.lang.String sortDetails)
Set the sort rules to use- Parameters:
sortDetails- the sort rules in internal string representation
-
getSortDetails
public java.lang.String getSortDetails()
Get the sort rules to use- Returns:
- the sort rules in internal string representation
-
stepInit
public void stepInit() throws WekaExceptionInitialize the step.- Throws:
WekaException- if a problem occurs during initialization
-
getIncomingConnectionTypes
public java.util.List<java.lang.String> getIncomingConnectionTypes()
Get a list of incoming connection types that this step can accept. Ideally (and if appropriate), this should take into account the state of the step and any existing incoming connections. E.g. a step might be able to accept one (and only one) incoming batch data connection.- Returns:
- a list of incoming connections that this step can accept given its current state
-
getOutgoingConnectionTypes
public java.util.List<java.lang.String> getOutgoingConnectionTypes()
Get a list of outgoing connection types that this step can produce. Ideally (and if appropriate), this should take into account the state of the step and the incoming connections. E.g. depending on what incoming connection is present, a step might be able to produce a trainingSet output, a testSet output or neither, but not both.- Returns:
- a list of outgoing connections that this step can produce
-
processIncoming
public void processIncoming(Data data) throws WekaException
Process an incoming data payload (if the step accepts incoming connections)- Specified by:
processIncomingin interfaceBaseStepExtender- Specified by:
processIncomingin interfaceStep- Overrides:
processIncomingin classBaseStep- Parameters:
data- the data to process- Throws:
WekaException- if a problem occurs
-
getCustomEditorForStep
public java.lang.String getCustomEditorForStep()
Return the fully qualified name of a custom editor component (JComponent) to use for editing the properties of the step. This method can return null, in which case the system will dynamically generate an editor using the GenericObjectEditor- Specified by:
getCustomEditorForStepin interfaceStep- Overrides:
getCustomEditorForStepin classBaseStep- Returns:
- the fully qualified name of a step editor component
-
-