Billing: differentiate between flag FillLowerBins

This commit is contained in:
2023-10-15 01:09:55 +02:00
parent 5657a8f90a
commit 62bf425313
2 changed files with 7 additions and 5 deletions

View File

@ -327,13 +327,14 @@ namespace Elwig.Helpers {
}
}
public static IEnumerable<IEnumerable<T>> Permutate<T>(IEnumerable<T> input) {
List<IEnumerable<T>> output = new();
public static IEnumerable<IEnumerable<T>> Permutate<T>(IEnumerable<T> input, IEnumerable<T>? forced = null) {
HashSet<IEnumerable<T>> output = new();
for (int i = 0; i < Math.Pow(2, input.Count()); i++) {
List<T> t = new();
for (int j = 0; j < 30; j++) {
if ((i & (1 << j)) != 0) {
t.Add(input.ElementAt(j));
var e = input.ElementAtOrDefault(j);
if (e != null && ((forced?.Contains(e) ?? false) || (i & (1 << j)) != 0)) {
t.Add(e);
}
}
output.Add(t);