org.annotation.util
Class MergeSort

java.lang.Object
  extended byorg.annotation.util.MergeSort

public abstract class MergeSort
extends java.lang.Object

An implementation of MergeSort, needs to be subclassed to compare the terms.

Author:
Scott Violet adapted from example at http://java.sun.com/products/jfc/tsc/articles/treetable2/

Field Summary
protected  java.lang.Object[] swapSpace
           
protected  java.lang.Object[] toSort
           
 
Constructor Summary
MergeSort()
           
 
Method Summary
abstract  int compareElementsAt(int beginLoc, int endLoc)
           
protected  void merge(int begin, int middle, int end)
           
protected  void mergeSort(int begin, int end)
           
 void sort(java.lang.Object[] array)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

toSort

protected java.lang.Object[] toSort

swapSpace

protected java.lang.Object[] swapSpace
Constructor Detail

MergeSort

public MergeSort()
Method Detail

sort

public void sort(java.lang.Object[] array)

compareElementsAt

public abstract int compareElementsAt(int beginLoc,
                                      int endLoc)

mergeSort

protected void mergeSort(int begin,
                         int end)

merge

protected void merge(int begin,
                     int middle,
                     int end)


Copyright © 2004 Thomas Morton and Jeremy LaCivita. All Rights Reserved.