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

Method getPercent

core/src/processing/data/FloatList.java:856–867  ·  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

854 * normalization in place on int values).
855 */
856 public FloatList getPercent() {
857 double sum = 0;
858 for (float value : array()) {
859 sum += value;
860 }
861 FloatList outgoing = new FloatList(count);
862 for (int i = 0; i < count; i++) {
863 double percent = data[i] / sum;
864 outgoing.set(i, (float) percent);
865 }
866 return outgoing;
867 }
868
869
870 public FloatList getSubset(int start) {

Callers

nothing calls this directly

Calls 2

arrayMethod · 0.95
setMethod · 0.95

Tested by

no test coverage detected