|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.adventnet.utilities.sort.Sorter
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 :
| Field Summary | |
(package private) static boolean |
flag
|
(package private) java.lang.Object[][] |
obj
|
| Constructor Summary | |
Sorter()
The Default Constructor for Sorter. |
|
| Method Summary | |
(package private) static int[] |
addIntArrays(int[] first,
int[] second)
|
static int |
compareTo(int[] oid1,
int[] oid2)
Compares two Integer arrays |
static int |
compareTo(java.lang.String str1,
java.lang.String str2)
This method compares two string considering it be OID string. |
(package private) static int |
getMinSize(int[] oid1,
int[] oid2)
|
(package private) static java.lang.String |
intArrayToString(int[] arr)
|
(package private) static java.lang.String |
intArrayToStringWithSpace(int[] arr)
|
(package private) static java.lang.String |
LongArrayToStringWithSpace(java.lang.Long[] arr)
|
static void |
main(java.lang.String[] args)
|
(package private) void |
QuickSort(int[] a,
int lo0,
int hi0)
This is a generic version of C.A.R Hoare's Quick Sort algorithm. |
(package private) void |
QuickSort(java.lang.Long[] a,
int lo0,
int hi0)
This is a generic version of C.A.R Hoare's Quick Sort algorithm. |
(package private) 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 |
setAscending(boolean flag)
This method is used to define the nature of sorting - either ascending or descending. |
void |
setFirstValueInt(boolean flag)
This method is used to define the nature of sorting - either firstValue of the String is int |
void |
sort(int[] a)
This method will sort the given int array. |
void |
sort(java.lang.Long[] a)
This method will sort the given Long array. |
void |
sort(java.lang.String[] a,
java.lang.Object[][] obj)
This method sorts the OID string array in ascending order. |
void |
sort(java.lang.String[] a,
java.lang.Object[][] obj,
boolean endValueInt)
This method sorts the OID string array in ascending order. |
(package private) static java.lang.String |
StringArrayToStringWithSpace(java.lang.String[] arr)
|
static int[] |
stringToIntArray(java.lang.String str)
converts string OID to array of int datatype |
static int[] |
stringToIntegerArray(java.lang.String str)
converts string OID to array of int datatype |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
java.lang.Object[][] obj
static boolean flag
| Constructor Detail |
public Sorter()
| Method Detail |
void QuickSort(java.lang.String[] a,
int lo0,
int hi0)
throws java.lang.Exception
a - an integer arraylo0 - left boundary of array partitionhi0 - right boundary of array partition
void QuickSort(java.lang.Long[] a,
int lo0,
int hi0)
throws java.lang.Exception
a - an Long arraylo0 - left boundary of array partitionhi0 - right boundary of array partitionpublic void setAscending(boolean flag)
Flag - True for Sorting in ascending orderm, False for Sorting in Descending order.public void setFirstValueInt(boolean flag)
Flag - True for the first value as int
public static int compareTo(java.lang.String str1,
java.lang.String str2)
str1 - The First String representation of the OID.str2 - The Second String representation of the OID.
public void sort(java.lang.String[] a,
java.lang.Object[][] obj)
throws java.lang.Exception
a - the key string array to be sorted.obj - the multiarray objects which are sorted according to the
key oid.
public void sort(java.lang.String[] a,
java.lang.Object[][] obj,
boolean endValueInt)
throws java.lang.Exception
a - the key string array to be sorted.obj - the multiarray objects which are sorted according to the
key oid.
void QuickSort(int[] a,
int lo0,
int hi0)
throws java.lang.Exception
a - an integer arraylo0 - left boundary of array partitionhi0 - right boundary of array partition
public void sort(int[] a)
throws java.lang.Exception
a - The Integer array to be sorted.
public void sort(java.lang.Long[] a)
throws java.lang.Exception
a - The Long array to be sorted.public static int[] stringToIntArray(java.lang.String str)
public static int[] stringToIntegerArray(java.lang.String str)
public static int compareTo(int[] oid1,
int[] oid2)
oid1 - array of integer of oidoid2 - array of integer of oid
static int getMinSize(int[] oid1,
int[] oid2)
static int[] addIntArrays(int[] first,
int[] second)
static java.lang.String intArrayToString(int[] arr)
static java.lang.String intArrayToStringWithSpace(int[] arr)
static java.lang.String LongArrayToStringWithSpace(java.lang.Long[] arr)
static java.lang.String StringArrayToStringWithSpace(java.lang.String[] arr)
public static void main(java.lang.String[] args)
throws java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||