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

Method sortReverse

core/src/processing/data/FloatList.java:669–709  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

runMethod · 0.65

Tested by

no test coverage detected