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

Method getPercent

core/src/processing/data/DoubleDict.java:781–789  ·  view source on GitHub ↗

Sum all of the values in this dictionary, then return a new FloatDict of each key, divided by the total sum. The total for all values will be ~1.0. @return a FloatDict with the original keys, mapped to their pct of the total

()

Source from the content-addressed store, hash-verified

779 * @return a FloatDict with the original keys, mapped to their pct of the total
780 */
781 public DoubleDict getPercent() {
782 double sum = sum();
783 DoubleDict outgoing = new DoubleDict();
784 for (int i = 0; i < size(); i++) {
785 double percent = value(i) / sum;
786 outgoing.set(key(i), percent);
787 }
788 return outgoing;
789 }
790
791
792 /** Returns a duplicate copy of this object. */

Callers

nothing calls this directly

Calls 5

sumMethod · 0.95
sizeMethod · 0.95
valueMethod · 0.95
setMethod · 0.95
keyMethod · 0.95

Tested by

no test coverage detected