Class Sort

java.lang.Object
VASSAL.tools.Sort

@Deprecated(since="2021-12-01", forRemoval=true) public class Sort extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
Use {link java.util.Collections.sort} instead.
Quicksort implementation so we can sort using JRE 1.1
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use the natural ordering on Strings instead.
    static interface 
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use Comparator instead.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Quicksort will rearrange elements when they are all equal.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Sort

      public Sort()
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • quicksort

      public static void quicksort(Vector<Object> v, Sort.Comparator comp)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Quicksort will rearrange elements when they are all equal. Make sure at least two elements differ. Sort using the specified comparator object
      
       public static boolean needsSorting(Vector v) {
         IComparable prev = null;
         IComparable curr;
         for (Enumeration e = v.elements(); e.hasMoreElements(); ) {
           curr = (IComparable)e.nextElement();
           if (prev != null && prev.compareTo(curr) != 0)
             return true;
           prev = curr;
         }
         return false;
       }