Using SortLibrary as is, you could do what you want by defining an
IntObject to wrap an Integer value, then sort an array of type
IntObject; indeed, that's what I'm sorting in my test code.
Charles Yeomans
On Sep 11, 2006, at 7:01 PM, Daniel Pereira wrote:
I knew that I was not clear enough. I need to sort a array of
integer using
a comparator. The reason is that i'm not really sorting integer, I
sort a 2D
array of string with a 1D array of intger. Where the array of
integer is a
reference to the row of the 2D array. When the sort library calls the
comparator, I don't compare the values of the array but the value
reference
by it.
Index RowArray() StringArray()
1 1 B
2 2 E
3 3 A
4 4 C
5 5 D
After the sort
Index RowArray() StringArray()
1 3 B
2 1 E
3 4 A
4 5 C
5 2 D
Only the RowArray() is changed, I don't want StringArray() to
change. But
I'm able to display StringArray() in alphabetical order using the
RowArray()
What I need is to be have a sort fonction with a integer array as
parameter
SortLibrary ( theList() as integer,
c as IntegerComparator,
firstIndex as Integer,
lastIndex as Integer )
And obviously the integerComparator
I've just finish doing so using the string sort. But I have to copy
and
convert the integer array in a string array. And once the sort is
done, I
have to copy and convert back to a integer array. But It works like
a charm.
Because I need a Comparator, I can't use RB array.sort.
I hope I'm a bit more clearer.
Thanks
Daniel
Le 11/09/2006 5:53 PM, « [NOM] » <[ADRESSE]> a écrit :
I'm not quite sure what you're asking for. Is it that you want to
sort the rows of a 2D Integer array? Certainly Array.Sort works for
1D Integer arrays.
Charles Yeomans
On Sep 11, 2006, at 5:25 PM, Daniel Pereira wrote:
Hi Charles,
Your library is very well designed. I figured a way using the
comparator
class to sort 2D array acting as records and also doing multi
columns sorts.
For this I need to sort integer arrays. I've used the string array
sort
(converting integer to string) for my test.
Is it possible for you to add this feature in your library. I know
that I
can duplicate and convert certain method to sort integer instead of
string.
But I don't like to touch good librairies...
Maybe it is easily done using the object sorting. Is a array of
integer can
be considered an array of object in your library?
I first tested the water using the listbox.sort with its comparator
for
doing 2D arrays. It works also. But your library is much faster...
(time in ticks)
Records ListBox.sort Sortlibrary
500 <1 <1
1000 8 2 4 x
5000 60 10 6 x
10000 125 25 5 x
20000 1000 40 25 x
100000 7800 160 48 x
So the bigger the record number, the greater is the différence.
Thanks
Daniel Pereira
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>