com.github.skjolberg.packing.impl.BinarySearchIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of 3d-bin-container-packing Show documentation
Show all versions of 3d-bin-container-packing Show documentation
Library for 3D rectangular bin packing
package com.github.skjolberg.packing.impl;
public class BinarySearchIterator {
private int low;
private int high;
private int mid;
BinarySearchIterator(int low, int high) {
super();
this.low = low;
this.high = high;
}
public BinarySearchIterator() {
}
public int next() {
return mid = low + (high - low) / 2;
}
public void lower() {
high = mid - 1;
}
public void higher() {
low = mid + 1;
}
public boolean hasNext() {
return low <= high;
}
public void reset(int high, int low) {
this.high = high;
this.low = low;
}
}