arlut.csd.Util
Class VecSortInsert

java.lang.Object
  |
  +--arlut.csd.Util.VecSortInsert
All Implemented Interfaces:
Compare

public class VecSortInsert
extends java.lang.Object
implements Compare

This class is used to do an ordered insert using a binary search. It's designed for speed. Used in the Ganymede client to efficiently add new items to the client's object tree. Uses the Compare interface for ordering comparisons.


Field Summary
(package private)  arlut.csd.Util.Compare comparator
           
(package private) static boolean debug
           
 
Constructor Summary
VecSortInsert()
          Constructor.
VecSortInsert(arlut.csd.Util.Compare comparator)
          Constructor.
 
Method Summary
 int compare(java.lang.Object a, java.lang.Object b)
          Default comparator, does a string comparison on the toString() output of the objects for ordering.
 void insert(java.util.Vector objects, java.lang.Object element)
          This method does the work.
static void insert(java.util.Vector objects, java.lang.Object element, arlut.csd.Util.Compare comparator)
          This static method does the work.
static void main(java.lang.String[] argv)
           
(package private) static void printTest(int size, int low, int med, int high)
           
(package private) static void printTest(java.util.Vector vec)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

comparator

arlut.csd.Util.Compare comparator

debug

static final boolean debug
See Also:
Constant Field Values
Constructor Detail

VecSortInsert

public VecSortInsert()

Constructor. By not specifying a comparator, an ordinary string comparison will be performed on elements inserted.


VecSortInsert

public VecSortInsert(arlut.csd.Util.Compare comparator)

Constructor. If comparator is null, an ordinary string comparison will be performed on elements inserted.

Method Detail

main

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

printTest

static void printTest(java.util.Vector vec)

printTest

static void printTest(int size,
                      int low,
                      int med,
                      int high)

insert

public static void insert(java.util.Vector objects,
                          java.lang.Object element,
                          arlut.csd.Util.Compare comparator)
This static method does the work.


insert

public void insert(java.util.Vector objects,
                   java.lang.Object element)
This method does the work.


compare

public int compare(java.lang.Object a,
                   java.lang.Object b)

Default comparator, does a string comparison on the toString() output of the objects for ordering.

Specified by:
compare in interface Compare