Skip to content

Commit

Permalink
0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
squid233 committed Jun 11, 2023
1 parent c3754ab commit db09ec5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/org/overrun/binpacking/PackerRegion.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static PackerRegion<Object> sized(int width, int height) {
* @param size the size of the region.
* @return the region.
*/
static PackerRegion<Object> delegate(PackerRegionSize size) {
static PackerRegion<?> delegate(PackerRegionSize size) {
return delegate(size, null);
}

Expand Down Expand Up @@ -85,9 +85,11 @@ static <T> PackerRegion<T> delegate(PackerRegionSize size, T userdata) {
* Performs the given action if {@link #fit() fit} position is present.
*
* @param consumer the action to be performed.
* @param <R> the type of this region.
*/
default void ifFitPresent(BiConsumer<PackerRegion<T>, PackerFitPos> consumer) {
fit().ifPresent(fit -> consumer.accept(this, fit));
@SuppressWarnings("unchecked")
default <R extends PackerRegion<T>> void ifFitPresent(BiConsumer<R, PackerFitPos> consumer) {
fit().ifPresent(fit -> consumer.accept((R) this, fit));
}

/**
Expand Down

0 comments on commit db09ec5

Please sign in to comment.