diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/LSL_Types.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | 182 |
1 files changed, 91 insertions, 91 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index 3b2594d..e98dec6 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | |||
@@ -634,97 +634,97 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
634 | } | 634 | } |
635 | } | 635 | } |
636 | 636 | ||
637 | private class AlphanumComparatorFast : IComparer | 637 | private class AlphanumComparatorFast : IComparer |
638 | { | 638 | { |
639 | public int Compare(object x, object y) | 639 | public int Compare(object x, object y) |
640 | { | 640 | { |
641 | string s1 = x as string; | 641 | string s1 = x as string; |
642 | if (s1 == null) | 642 | if (s1 == null) |
643 | { | 643 | { |
644 | return 0; | 644 | return 0; |
645 | } | 645 | } |
646 | string s2 = y as string; | 646 | string s2 = y as string; |
647 | if (s2 == null) | 647 | if (s2 == null) |
648 | { | 648 | { |
649 | return 0; | 649 | return 0; |
650 | } | 650 | } |
651 | 651 | ||
652 | int len1 = s1.Length; | 652 | int len1 = s1.Length; |
653 | int len2 = s2.Length; | 653 | int len2 = s2.Length; |
654 | int marker1 = 0; | 654 | int marker1 = 0; |
655 | int marker2 = 0; | 655 | int marker2 = 0; |
656 | 656 | ||
657 | // Walk through two the strings with two markers. | 657 | // Walk through two the strings with two markers. |
658 | while (marker1 < len1 && marker2 < len2) | 658 | while (marker1 < len1 && marker2 < len2) |
659 | { | 659 | { |
660 | char ch1 = s1[marker1]; | 660 | char ch1 = s1[marker1]; |
661 | char ch2 = s2[marker2]; | 661 | char ch2 = s2[marker2]; |
662 | 662 | ||
663 | // Some buffers we can build up characters in for each chunk. | 663 | // Some buffers we can build up characters in for each chunk. |
664 | char[] space1 = new char[len1]; | 664 | char[] space1 = new char[len1]; |
665 | int loc1 = 0; | 665 | int loc1 = 0; |
666 | char[] space2 = new char[len2]; | 666 | char[] space2 = new char[len2]; |
667 | int loc2 = 0; | 667 | int loc2 = 0; |
668 | 668 | ||
669 | // Walk through all following characters that are digits or | 669 | // Walk through all following characters that are digits or |
670 | // characters in BOTH strings starting at the appropriate marker. | 670 | // characters in BOTH strings starting at the appropriate marker. |
671 | // Collect char arrays. | 671 | // Collect char arrays. |
672 | do | 672 | do |
673 | { | 673 | { |
674 | space1[loc1++] = ch1; | 674 | space1[loc1++] = ch1; |
675 | marker1++; | 675 | marker1++; |
676 | 676 | ||
677 | if (marker1 < len1) | 677 | if (marker1 < len1) |
678 | { | 678 | { |
679 | ch1 = s1[marker1]; | 679 | ch1 = s1[marker1]; |
680 | } | 680 | } |
681 | else | 681 | else |
682 | { | 682 | { |
683 | break; | 683 | break; |
684 | } | 684 | } |
685 | } while (char.IsDigit(ch1) == char.IsDigit(space1[0])); | 685 | } while (char.IsDigit(ch1) == char.IsDigit(space1[0])); |
686 | 686 | ||
687 | do | 687 | do |
688 | { | 688 | { |
689 | space2[loc2++] = ch2; | 689 | space2[loc2++] = ch2; |
690 | marker2++; | 690 | marker2++; |
691 | 691 | ||
692 | if (marker2 < len2) | 692 | if (marker2 < len2) |
693 | { | 693 | { |
694 | ch2 = s2[marker2]; | 694 | ch2 = s2[marker2]; |
695 | } | 695 | } |
696 | else | 696 | else |
697 | { | 697 | { |
698 | break; | 698 | break; |
699 | } | 699 | } |
700 | } while (char.IsDigit(ch2) == char.IsDigit(space2[0])); | 700 | } while (char.IsDigit(ch2) == char.IsDigit(space2[0])); |
701 | 701 | ||
702 | // If we have collected numbers, compare them numerically. | 702 | // If we have collected numbers, compare them numerically. |
703 | // Otherwise, if we have strings, compare them alphabetically. | 703 | // Otherwise, if we have strings, compare them alphabetically. |
704 | string str1 = new string(space1); | 704 | string str1 = new string(space1); |
705 | string str2 = new string(space2); | 705 | string str2 = new string(space2); |
706 | 706 | ||
707 | int result; | 707 | int result; |
708 | 708 | ||
709 | if (char.IsDigit(space1[0]) && char.IsDigit(space2[0])) | 709 | if (char.IsDigit(space1[0]) && char.IsDigit(space2[0])) |
710 | { | 710 | { |
711 | int thisNumericChunk = int.Parse(str1); | 711 | int thisNumericChunk = int.Parse(str1); |
712 | int thatNumericChunk = int.Parse(str2); | 712 | int thatNumericChunk = int.Parse(str2); |
713 | result = thisNumericChunk.CompareTo(thatNumericChunk); | 713 | result = thisNumericChunk.CompareTo(thatNumericChunk); |
714 | } | 714 | } |
715 | else | 715 | else |
716 | { | 716 | { |
717 | result = str1.CompareTo(str2); | 717 | result = str1.CompareTo(str2); |
718 | } | 718 | } |
719 | 719 | ||
720 | if (result != 0) | 720 | if (result != 0) |
721 | { | 721 | { |
722 | return result; | 722 | return result; |
723 | } | 723 | } |
724 | } | 724 | } |
725 | return len1 - len2; | 725 | return len1 - len2; |
726 | } | 726 | } |
727 | } | 727 | } |
728 | 728 | ||
729 | public list Sort(int stride, int ascending) | 729 | public list Sort(int stride, int ascending) |
730 | { | 730 | { |