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

Method getPercent

core/src/processing/data/IntList.java:843–854  ·  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

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

Callers

nothing calls this directly

Calls 2

arrayMethod · 0.95
setMethod · 0.95

Tested by

no test coverage detected