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

Method getPercent

core/src/processing/data/LongList.java:844–855  ·  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 returns 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

842 * normalization in place on int values).
843 */
844 public FloatList getPercent() {
845 double sum = 0;
846 for (float value : array()) {
847 sum += value;
848 }
849 FloatList outgoing = new FloatList(count);
850 for (int i = 0; i < count; i++) {
851 double percent = data[i] / sum;
852 outgoing.set(i, (float) percent);
853 }
854 return outgoing;
855 }
856
857
858// /**

Callers

nothing calls this directly

Calls 2

arrayMethod · 0.95
setMethod · 0.95

Tested by

no test coverage detected