XMOJO 5 API Docs

com.adventnet.jmx.utils
Class Sorter

java.lang.Object
  |
  +--com.adventnet.jmx.utils.Sorter
All Implemented Interfaces:
java.io.Serializable

public class Sorter
extends java.lang.Object
implements java.io.Serializable

This is a utility class which sorts a objectID array using quick sort mechanism .By default the compareTo method compares two strings str1 & str2 considering it to be a OID string. API users may override this method inorder to have their own compareTo method incase of different type of string.

Usage is :

  • sorter = new Sorter();
  • toSort = new String[2]{".1.3.6.1.3.2", ".1.3.6.1.3.12",};
  • sorter.sort(toSort, null);

    See Also:
    Serialized Form

    Constructor Summary
    Sorter()
               
     
    Method Summary
     void QuickSort(int[] a, int lo0, int hi0)
              This is a generic version of C.A.R Hoare's Quick Sort algorithm.
     void QuickSort(java.lang.String[] a, int lo0, int hi0)
              This is a generic version of C.A.R Hoare's Quick Sort algorithm.
     void sort(int[] a)
               
     void sort(java.lang.String[] a, java.lang.Object[][] obj)
              This method sorts the OID string array in ascending order.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    Sorter

    public Sorter()
    Method Detail

    QuickSort

    public void QuickSort(java.lang.String[] a,
                          int lo0,
                          int hi0)
                   throws java.lang.Exception
    This is a generic version of C.A.R Hoare's Quick Sort algorithm. This will handle arrays that are already sorted, and arrays with duplicate keys.
    If you think of a one dimensional array as going from the lowest index on the left to the highest index on the right then the parameters to this function are lowest index or left and highest index or right. The first time you call this function it will be with the parameters 0, a.length - 1.
    Parameters:
    a - an integer array
    lo0 - left boundary of array partition
    hi0 - right boundary of array partition

    sort

    public void sort(java.lang.String[] a,
                     java.lang.Object[][] obj)
              throws java.lang.Exception
    This method sorts the OID string array in ascending order. Also it sorts multi array objects in "obj" according to the key OID string array "a".
    Parameters:
    a - the key string array to be sorted.
    obj - the multiarray objects which are sorted according to the key oid.

    QuickSort

    public void QuickSort(int[] a,
                          int lo0,
                          int hi0)
                   throws java.lang.Exception
    This is a generic version of C.A.R Hoare's Quick Sort algorithm. This will handle arrays that are already sorted, and arrays with duplicate keys.
    If you think of a one dimensional array as going from the lowest index on the left to the highest index on the right then the parameters to this function are lowest index or left and highest index or right. The first time you call this function it will be with the parameters 0, a.length - 1.
    Parameters:
    a - an integer array
    lo0 - left boundary of array partition
    hi0 - right boundary of array partition

    sort

    public void sort(int[] a)
              throws java.lang.Exception

    XMOJO 5 API Docs

    Copyright ©2003 XMOJO.org. All Rights Reserved.