com.fasterxml.sort
Interface SortingState

All Known Implementing Classes:
Sorter, TextFileSorter

public interface SortingState

Interface that defines how calling application can interact with a Sorter; both by accessing progress information and by requesting cancellation if necessary. It is implemented by Sorter.


Nested Class Summary
static class SortingState.Phase
          Different phases that sorter goes through
 
Method Summary
 void cancel()
          Method that can be used to try to cancel executing sort operation.
 void cancel(IOException e)
          Method that can be used to try to cancel executing sort operation.
 void cancel(RuntimeException e)
          Method that can be used to try to cancel executing sort operation.
 int getNumberOfPreSortFiles()
          Accessor for checking how many pre-sort files were created during pre-sort phase.
 int getNumberOfSortRounds()
          Accessor for figuring out how many regular sorting rounds need to be taken to complete sorting, if known.
 SortingState.Phase getPhase()
           
 int getSortRound()
          Accessor for checking which sorting round sorter is doing: for pre-sort it basically means number of segment (0-based) that is being processed in-memory, for regular sort it is number of (0-based) sorting round.
 boolean isCompleted()
          Accessor for determining whether sorting has been succesfully completed or not.
 boolean isPreSorting()
          Accessor for determining whether sorter is in its in-memory pre-sorting phase.
 boolean isSorting()
          Accessor for determining whether sorter is in regular merge-sort phase or not.
 

Method Detail

getPhase

SortingState.Phase getPhase()

isPreSorting

boolean isPreSorting()
Accessor for determining whether sorter is in its in-memory pre-sorting phase.


isSorting

boolean isSorting()
Accessor for determining whether sorter is in regular merge-sort phase or not.


isCompleted

boolean isCompleted()
Accessor for determining whether sorting has been succesfully completed or not.


getNumberOfPreSortFiles

int getNumberOfPreSortFiles()
Accessor for checking how many pre-sort files were created during pre-sort phase. Can be zero if the whole data fit in memory during pre-sorting.


getSortRound

int getSortRound()
Accessor for checking which sorting round sorter is doing: for pre-sort it basically means number of segment (0-based) that is being processed in-memory, for regular sort it is number of (0-based) sorting round.


getNumberOfSortRounds

int getNumberOfSortRounds()
Accessor for figuring out how many regular sorting rounds need to be taken to complete sorting, if known. If information is not known, will return -1. This information generally becomes available after pre-sorting round.


cancel

void cancel()
Method that can be used to try to cancel executing sort operation. No exception will be thrown; sorting will just be stopped as soon as sorting thread notices request.


cancel

void cancel(RuntimeException e)
Method that can be used to try to cancel executing sort operation. Exception object can be specified; if non-null instance is given, it will be thrown to indicate erroneous result, otherwise sorting is just interrupted but execution returns normally.


cancel

void cancel(IOException e)
Method that can be used to try to cancel executing sort operation. Exception object can be specified; if non-null instance is given, it will be thrown to indicate erroneous result, otherwise sorting is just interrupted but execution returns normally.



Copyright © 2011. All Rights Reserved.