Class SpreadSheetSort

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, VariablesInspectionHandler, InPlaceProcessing, VariableChangeListener, Actor, ErrorHandler, InputConsumer, OutputProducer, Serializable, Comparable

    public class SpreadSheetSort
    extends AbstractInPlaceSpreadSheetTransformer
    Sorts the rows of the spreadsheet according to the selected column indices and sort order (ascending/descending).

    Input/output:
    - accepts:
       adams.data.spreadsheet.SpreadSheet
    - generates:
       adams.data.spreadsheet.SpreadSheet


    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: SpreadSheetSort
     
    -annotation <adams.core.base.BaseText> (property: annotations)
        The annotations to attach to this actor.
        default: 
     
    -skip <boolean> (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded 
        as it is.
        default: false
     
    -stop-flow-on-error <boolean> (property: stopFlowOnError)
        If set to true, the flow gets stopped in case this actor encounters an error;
         useful for critical actors.
        default: false
     
    -no-copy <boolean> (property: noCopy)
        If enabled, no copy of the spreadsheet is created before processing it.
        default: false
     
    -sort-column <adams.data.spreadsheet.SpreadSheetColumnIndex> [-sort-column ...] (property: sortColumn)
        The columns to use for sorting.
        default: first
        example: An index is a number starting with 1; apart from column names (case-sensitive), the following placeholders can be used as well: first, second, third, last_2, last_1, last
     
    -sort-order <adams.core.base.BaseBoolean> [-sort-order ...] (property: sortOrder)
        The order of sorting for the columns (true = ascending, false = descending
        ).
        default: true
     
    -unique <boolean> (property: unique)
        If enabled, all duplicate rows (according to the sort setup) get dropped.
        default: false
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_SortColumn

        protected SpreadSheetColumnIndex[] m_SortColumn
        the indices of the columns to use for sorting.
      • m_SortOrder

        protected BaseBoolean[] m_SortOrder
        whether to use ascending or descending sort order.
      • m_Unique

        protected boolean m_Unique
        whether to perform a unique sort.
    • Constructor Detail

      • SpreadSheetSort

        public SpreadSheetSort()
    • Method Detail

      • setSortColumn

        public void setSortColumn​(SpreadSheetColumnIndex[] value)
        Sets the indices of the columns to use for sorting.
        Parameters:
        value - the columns
      • getSortColumn

        public SpreadSheetColumnIndex[] getSortColumn()
        Returns the indices of the columns to use for sorting.
        Returns:
        the columns
      • sortColumnTipText

        public String sortColumnTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setSortOrder

        public void setSortOrder​(BaseBoolean[] value)
        Sets the sorting order for the columns (ascending/descending).
        Parameters:
        value - the order (true=asc)
      • getSortOrder

        public BaseBoolean[] getSortOrder()
        Returns the sorting order for the columns (ascending/descending).
        Returns:
        the order (true=asc)
      • sortOrderTipText

        public String sortOrderTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setUnique

        public void setUnique​(boolean value)
        Sets whether to drop duplicate rows during sort.
        Parameters:
        value - true if to drop duplicate rows
      • getUnique

        public boolean getUnique()
        Returns whether to drop duplicate rows during sort.
        Returns:
        true if duplicate rows dropped
      • uniqueTipText

        public String uniqueTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • doExecute

        protected String doExecute()
        Executes the flow item.
        Specified by:
        doExecute in class AbstractActor
        Returns:
        null if everything is fine, otherwise error message