upr.u7
Class ExternalSort

java.lang.Object
  |
  +--upr.u7.ExternalSort

public class ExternalSort
extends java.lang.Object
implements upr.utils.SortFile

Simple External Sort, uses MergeSort with two scratch files and a buffer.


Field Summary
static int DEFAULT_BUFFER_SIZE
           
 
Constructor Summary
ExternalSort()
          Default Constructor
ExternalSort(int bufferSize)
          Constructs an object that sorts files of Item objects, with given 'bufferSize' - the size of each section (buffer) used in the external sorting.
 
Method Summary
 void sort(java.lang.String fname, java.util.Comparator c)
          Sorts the file 'fname' of objects of class Item using the given comparator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
Constructor Detail

ExternalSort

public ExternalSort()
Default Constructor

ExternalSort

public ExternalSort(int bufferSize)
Constructs an object that sorts files of Item objects, with given 'bufferSize' - the size of each section (buffer) used in the external sorting.
Method Detail

sort

public void sort(java.lang.String fname,
                 java.util.Comparator c)
Sorts the file 'fname' of objects of class Item using the given comparator
Specified by:
sort in interface upr.utils.SortFile