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

Method getPercent

core/src/processing/data/DoubleList.java:848–859  ·  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

846 * normalization in place on int values).
847 */
848 public DoubleList getPercent() {
849 double sum = 0;
850 for (double value : array()) {
851 sum += value;
852 }
853 DoubleList outgoing = new DoubleList(count);
854 for (int i = 0; i < count; i++) {
855 double percent = data[i] / sum;
856 outgoing.set(i, percent);
857 }
858 return outgoing;
859 }
860
861
862 public DoubleList getSubset(int start) {

Callers

nothing calls this directly

Calls 2

arrayMethod · 0.95
setMethod · 0.95

Tested by

no test coverage detected