From 97c94baa0140f9cbb26d8dd123432181e84a4bab Mon Sep 17 00:00:00 2001 From: marecabo <23156476+marecabo@users.noreply.github.com> Date: Fri, 1 Mar 2024 15:30:14 +0100 Subject: [PATCH] Add getter for totalWeight to WeightedRandomSelection --- .../matsim/contrib/common/util/WeightedRandomSelection.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contribs/common/src/main/java/org/matsim/contrib/common/util/WeightedRandomSelection.java b/contribs/common/src/main/java/org/matsim/contrib/common/util/WeightedRandomSelection.java index 6e305111108..148174d67af 100644 --- a/contribs/common/src/main/java/org/matsim/contrib/common/util/WeightedRandomSelection.java +++ b/contribs/common/src/main/java/org/matsim/contrib/common/util/WeightedRandomSelection.java @@ -67,6 +67,10 @@ public int size() { return entryList.size(); } + public double getTotalWeight() { + return totalWeight; + } + private record Entry(E e, double cumulativeWeight) implements Comparable> { public int compareTo(Entry o) { double diff = this.cumulativeWeight - o.cumulativeWeight;