From db09ec599bf26d1b5c1dca50e5f85447ebf77c9b Mon Sep 17 00:00:00 2001 From: squid233 <60126026+squid233@users.noreply.github.com> Date: Sun, 11 Jun 2023 14:55:14 +0800 Subject: [PATCH] 0.4.0 --- changelog.txt | 3 +++ gradle.properties | 2 +- src/main/java/org/overrun/binpacking/PackerRegion.java | 8 +++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/changelog.txt b/changelog.txt index 8666336..3429367 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +0.4.0 +Changed: PackerRegion::ifFitPresent now requires an exact type + 0.3.0 Added: PackerRegion now provides a default implementation of ::equals, ::hashCode and ::toString diff --git a/gradle.properties b/gradle.properties index 81fd948..5b7d008 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Dfile.encoding=UTF-8 projGroupId=io.github.over-run projArtifactId=bin-packing projName=bin-packing -projVersion=0.3.0 +projVersion=0.4.0 projDesc=The Java port of jakesgordon/bin-packing. projVcs=Over-Run/bin-packing projBranch=0.x diff --git a/src/main/java/org/overrun/binpacking/PackerRegion.java b/src/main/java/org/overrun/binpacking/PackerRegion.java index 1731f13..20b4aed 100644 --- a/src/main/java/org/overrun/binpacking/PackerRegion.java +++ b/src/main/java/org/overrun/binpacking/PackerRegion.java @@ -51,7 +51,7 @@ static PackerRegion sized(int width, int height) { * @param size the size of the region. * @return the region. */ - static PackerRegion delegate(PackerRegionSize size) { + static PackerRegion delegate(PackerRegionSize size) { return delegate(size, null); } @@ -85,9 +85,11 @@ static PackerRegion delegate(PackerRegionSize size, T userdata) { * Performs the given action if {@link #fit() fit} position is present. * * @param consumer the action to be performed. + * @param the type of this region. */ - default void ifFitPresent(BiConsumer, PackerFitPos> consumer) { - fit().ifPresent(fit -> consumer.accept(this, fit)); + @SuppressWarnings("unchecked") + default > void ifFitPresent(BiConsumer consumer) { + fit().ifPresent(fit -> consumer.accept((R) this, fit)); } /**