weka.filters.unsupervised.attribute

## Class SortLabels

- java.lang.Object
- - weka.filters.Filter
  - - weka.filters.SimpleFilter
    - - weka.filters.SimpleStreamFilter
      - - weka.filters.unsupervised.attribute.SortLabels

- All Implemented Interfaces:
    java.io.Serializable, CapabilitiesHandler, CapabilitiesIgnorer, CommandlineRunnable, OptionHandler, RevisionHandler, WeightedAttributesHandler, WeightedInstancesHandler, StreamableFilter

      public class SortLabels
      extends SimpleStreamFilter
      implements WeightedInstancesHandler, WeightedAttributesHandler

  A simple filter for sorting the labels of nominal attributes.

  Valid options are:

       -D
        Turns on output of debugging information.

       -R <index1,index2-index4,...>
        Specify list of attributes to process.
        (default: select all nominal attributes)

       -V
        Inverts the matching sense of the selection.

       -S <CASE|NON-CASE>
        Determines the type of sorting:
        CASE = Case-sensitive
        NON-CASE = Case-insensitive
        (default: CASE)

  Version:
    $Revision: 14534 $
  Author:
    fracpete (fracpete at waikato dot ac dot nz)
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `SortLabels.CaseInsensitiveComparator` Represents a case-insensitive comparator for two strings.
    `static class` | `SortLabels.CaseSensitiveComparator` Represents a case-sensitive comparator for two strings.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `SORT_CASEINSENSITIVE` sorts the strings case-insensitive.
    `static int` | `SORT_CASESENSITIVE` sorts the strings case-sensitive.
    `static Tag[]` | `TAGS_SORTTYPE` Tag allowing selection of sort type.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SortLabels()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `attributeIndicesTipText()` Returns the tip text for this property.
    `java.lang.String` | `getAttributeIndices()` Gets the current selected attributes.
    `Capabilities` | `getCapabilities()` Returns the Capabilities of this filter.
    `boolean` | `getInvertSelection()` Gets whether the supplied columns are to be processed or skipped.
    `java.lang.String[]` | `getOptions()` Gets the current settings of the classifier.
    `java.lang.String` | `getRevision()` Returns the revision string.
    `SelectedTag` | `getSortType()` Gets the sort type to be used.
    `java.lang.String` | `globalInfo()` Returns a string describing this filter.
    `java.lang.String` | `invertSelectionTipText()` Returns the tip text for this property.
    `java.util.Enumeration<Option>` | `listOptions()` Returns an enumeration describing the available options.
    `static void` | `main(java.lang.String[] args)` runs the filter with the given arguments.
    `void` | `setAttributeIndices(java.lang.String value)` Set the range of attributes to process.
    `void` | `setInvertSelection(boolean value)` Sets whether selected columns should be processed or skipped.
    `void` | `setOptions(java.lang.String[] options)` Parses the options for this object.
    `void` | `setSortType(SelectedTag type)` Sets the sort type to be used.
    `java.lang.String` | `sortTypeTipText()` Returns the tip text for this property.

    - ### Methods inherited from class weka.filters.SimpleStreamFilter

      `batchFinished, input`

    - ### Methods inherited from class weka.filters.SimpleFilter

      `setInputFormat`

    - ### Methods inherited from class weka.filters.Filter

      `batchFilterFile, debugTipText, doNotCheckCapabilitiesTipText, filterFile, getCapabilities, getCopyOfInputFormat, getDebug, getDoNotCheckCapabilities, getOutputFormat, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, mayRemoveInstanceAfterFirstBatchDone, numPendingOutput, output, outputPeek, postExecution, preExecution, run, runFilter, setDebug, setDoNotCheckCapabilities, toString, useFilter, wekaStaticWrapper`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### SORT_CASESENSITIVE

          public static final int SORT_CASESENSITIVE

      sorts the strings case-sensitive.
      See Also:
        Constant Field Values

    - #### SORT_CASEINSENSITIVE

          public static final int SORT_CASEINSENSITIVE

      sorts the strings case-insensitive.
      See Also:
        Constant Field Values

    - #### TAGS_SORTTYPE

          public static final Tag[] TAGS_SORTTYPE

      Tag allowing selection of sort type.

  - ### Constructor Detail

    - #### SortLabels

          public SortLabels()

  - ### Method Detail

    - #### globalInfo

          public java.lang.String globalInfo()

      Returns a string describing this filter.
      Specified by:
        `globalInfo` in class `SimpleFilter`
      Returns:
        a description of the filter suitable for displaying in the explorer/experimenter gui

    - #### listOptions

          public java.util.Enumeration<Option> listOptions()

      Returns an enumeration describing the available options.
      Specified by:
        `listOptions` in interface `OptionHandler`
      Overrides:
        `listOptions` in class `Filter`
      Returns:
        an enumeration of all the available options.

    - #### setOptions

          public void setOptions(java.lang.String[] options)
                          throws java.lang.Exception

      Parses the options for this object.

      Valid options are:

           -D
            Turns on output of debugging information.

           -R <index1,index2-index4,...>
            Specify list of attributes to process.
            (default: select all nominal attributes)

           -V
            Inverts the matching sense of the selection.

           -S <CASE|NON-CASE>
            Determines the type of sorting:
            CASE = Case-sensitive
            NON-CASE = Case-insensitive
            (default: CASE)

      Specified by:
        `setOptions` in interface `OptionHandler`
      Overrides:
        `setOptions` in class `Filter`
      Parameters:
        `options` - the options to use
      Throws:
        `java.lang.Exception` - if setting of options fails

    - #### getOptions

          public java.lang.String[] getOptions()

      Gets the current settings of the classifier.
      Specified by:
        `getOptions` in interface `OptionHandler`
      Overrides:
        `getOptions` in class `Filter`
      Returns:
        an array of strings suitable for passing to setOptions

    - #### attributeIndicesTipText

          public java.lang.String attributeIndicesTipText()

      Returns the tip text for this property.
      Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui

    - #### setAttributeIndices

          public void setAttributeIndices(java.lang.String value)

      Set the range of attributes to process.
      Parameters:
        `value` - the new range.

    - #### getAttributeIndices

          public java.lang.String getAttributeIndices()

      Gets the current selected attributes.
      Returns:
        current selection.

    - #### invertSelectionTipText

          public java.lang.String invertSelectionTipText()

      Returns the tip text for this property.
      Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui

    - #### setInvertSelection

          public void setInvertSelection(boolean value)

      Sets whether selected columns should be processed or skipped.
      Parameters:
        `value` - the new invert setting

    - #### getInvertSelection

          public boolean getInvertSelection()

      Gets whether the supplied columns are to be processed or skipped.
      Returns:
        true if the supplied columns will be kept

    - #### sortTypeTipText

          public java.lang.String sortTypeTipText()

      Returns the tip text for this property.
      Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui

    - #### setSortType

          public void setSortType(SelectedTag type)

      Sets the sort type to be used.
      Parameters:
        `type` - the type of sorting

    - #### getSortType

          public SelectedTag getSortType()

      Gets the sort type to be used.
      Returns:
        the sort type

    - #### getCapabilities

          public Capabilities getCapabilities()

      Returns the Capabilities of this filter.
      Specified by:
        `getCapabilities` in interface `CapabilitiesHandler`
      Overrides:
        `getCapabilities` in class `Filter`
      Returns:
        the capabilities of this object
      See Also:
        `Capabilities`

    - #### getRevision

          public java.lang.String getRevision()

      Returns the revision string.
      Specified by:
        `getRevision` in interface `RevisionHandler`
      Overrides:
        `getRevision` in class `Filter`
      Returns:
        the revision

    - #### main

          public static void main(java.lang.String[] args)

      runs the filter with the given arguments.
      Parameters:
        `args` - the commandline arguments