MCPcopy Index your code
hub / github.com/benfry/processing4 / getPercent

Method getPercent

core/src/processing/data/IntList.java:792–804  ·  view source on GitHub ↗

Returns a normalized version of this array. Called getPercent() for consistency with the Dict classes. It's a getter method because it needs to return a new list (because IntList/Dict can't do percentages or normalization in place on int values).

()

Source from the content-addressed store, hash-verified

790 * percentages or normalization in place on int values).
791 */
792 @SuppressWarnings("unused")
793 public FloatList getPercent() {
794 double sum = 0;
795 for (float value : array()) {
796 sum += value;
797 }
798 FloatList outgoing = new FloatList(count);
799 for (int i = 0; i < count; i++) {
800 double percent = data[i] / sum;
801 outgoing.set(i, (float) percent);
802 }
803 return outgoing;
804 }
805
806
807 @SuppressWarnings("unused")

Callers

nothing calls this directly

Calls 2

arrayMethod · 0.95
setMethod · 0.95

Tested by

no test coverage detected