All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.skjolber.packing.api.DefaultStackValueConstraint Maven / Gradle / Ivy

There is a newer version: 3.0.9
Show newest version
package com.github.skjolber.packing.api;

public class DefaultStackValueConstraint implements StackConstraint {

	// structural integrity for this orientation
	protected final int maxSupportedWeight;
	
	public DefaultStackValueConstraint(int maxSupportedWeight) {
		this.maxSupportedWeight = maxSupportedWeight;
	}

	@Override
	public boolean supports(Stack stack, Stackable stackable, StackValue value, int x, int y, int z) {
		return accepts(stack, stackable);
	}
	
	@Override
	public boolean accepts(Stack stack, Stackable stackable) {
		return stack.getWeight() + stackable.getWeight() <= maxSupportedWeight;
	}

	@Override
	public boolean canAccept(Stackable stackable) {
		return stackable.getWeight() <= maxSupportedWeight;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy