MCPcopy Index your code
hub / github.com/processing/processing / sortReverse

Method sortReverse

core/src/processing/data/DoubleList.java:661–701  ·  view source on GitHub ↗

Reverse sort, orders values from highest to lowest @webref doublelist:method @brief Reverse sort, orders values from highest to lowest

()

Source from the content-addressed store, hash-verified

659 * @brief Reverse sort, orders values from highest to lowest
660 */
661 public void sortReverse() {
662 new Sort() {
663 @Override
664 public int size() {
665 // if empty, don't even mess with the NaN check, it'll AIOOBE
666 if (count == 0) {
667 return 0;
668 }
669 // move NaN values to the end of the list and don't sort them
670 int right = count - 1;
671 while (data[right] != data[right]) {
672 right--;
673 if (right == -1) { // all values are NaN
674 return 0;
675 }
676 }
677 for (int i = right; i >= 0; --i) {
678 double v = data[i];
679 if (v != v) {
680 data[i] = data[right];
681 data[right] = v;
682 --right;
683 }
684 }
685 return right + 1;
686 }
687
688 @Override
689 public int compare(int a, int b) {
690 double diff = data[b] - data[a];
691 return diff == 0 ? 0 : (diff < 0 ? -1 : 1);
692 }
693
694 @Override
695 public void swap(int a, int b) {
696 double temp = data[a];
697 data[a] = data[b];
698 data[b] = temp;
699 }
700 }.run();
701 }
702
703
704 // use insert()

Callers

nothing calls this directly

Calls 1

runMethod · 0.65

Tested by

no test coverage detected