From d4ca769e542b2489b1e23cfcbdc3a0b7275b87cd Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Mon, 13 Apr 2020 18:40:41 -0400 Subject: Cleanup pass Cleanup pass to uniformize things --- .../bjc/utils/funcutils/GroupPartIteration.java | 29 +++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'base/src/main/java/bjc/utils/funcutils/GroupPartIteration.java') diff --git a/base/src/main/java/bjc/utils/funcutils/GroupPartIteration.java b/base/src/main/java/bjc/utils/funcutils/GroupPartIteration.java index 455fbf8..681d707 100644 --- a/base/src/main/java/bjc/utils/funcutils/GroupPartIteration.java +++ b/base/src/main/java/bjc/utils/funcutils/GroupPartIteration.java @@ -12,7 +12,7 @@ import bjc.funcdata.IList; * @author ben * * @param - * The type of element in the list being partitioned + * The type of element in the list being partitioned */ final class GroupPartIteration implements Consumer { /* The list we're returning. */ @@ -35,21 +35,21 @@ final class GroupPartIteration implements Consumer { * Create a new group partitioning iteration. * * @param returned - * The list containing all of the existing partitions. + * The list containing all of the existing partitions. * * @param rejects - * The items that have been rejected from a partition for being - * too large. + * The items that have been rejected from a partition for being + * too large. * * @param nPerPart - * The combined value of items that should go into each - * partition. + * The combined value of items that should go into each + * partition. * * @param eleCount - * The function to use to determine the value of an item. + * The function to use to determine the value of an item. */ - public GroupPartIteration(final IList> returned, final IList rejects, final int nPerPart, - final Function eleCount) { + public GroupPartIteration(final IList> returned, final IList rejects, + final int nPerPart, final Function eleCount) { this.returnedList = returned; this.rejectedItems = rejects; this.numberPerPartition = nPerPart; @@ -61,9 +61,10 @@ final class GroupPartIteration implements Consumer { @Override public void accept(final E value) { - final boolean shouldStartPartition = numberInCurrentPartition >= numberPerPartition; + final boolean shouldStartPartition + = numberInCurrentPartition >= numberPerPartition; - if(shouldStartPartition) { + if (shouldStartPartition) { returnedList.add(currentPartition); currentPartition = new FunctionalList<>(); @@ -71,10 +72,10 @@ final class GroupPartIteration implements Consumer { } else { final int currentElementCount = elementCounter.apply(value); - final boolean shouldReject = (numberInCurrentPartition - + currentElementCount) >= numberPerPartition; + final boolean shouldReject = (numberInCurrentPartition + currentElementCount) + >= numberPerPartition; - if(shouldReject) { + if (shouldReject) { rejectedItems.add(value); } else { currentPartition.add(value); -- cgit v1.2.3