src/main/java/dev/rsoliveira/tools/binpacking/service/PackingService.java
/**
     * Simulates packing a list of items into a container, resulting in a list of solutions.
     * Each simulation iteration results in 2 lists of packed and unpacked items, and the next iteration uses
     * the unpacked items simulate the packing, until there are no items remaining to pack.
     * It is best to use this method to know how many containers are possibly needed to pack all the given items.
     * @param container the container used as template for packing.
     * @param items the list of all items that will be packed.
     * @return a list of possible packings, containing position and direction for each item inside the containers.
     */
Simulates packing a list of items into a container, resulting in a list of solutions.
Each simulation iteration results in 2 lists of packed and unpacked items, and the next iteration uses
the unpacked items simulate the packing, until there are no items remaining to pack.
It is best to use this method to know how many containers are possibly needed to pack all the given items.
@param container the container used as template for packing.
@param items the list of all items that will be packed.
@return a list of possible packings, containing position and direction for each item inside the containers.
Simulates packing a list of items into a container resulting in a list of solutions . Each simulation iteration results in 2 lists of packed and unpacked items and the next iteration uses the unpacked items simulate the packing until there are no items remaining to pack . It is best to use this method to know how many containers are possibly needed to pack all the given items . @param container the container used as template for packing . @param items the list of all items that will be packed . @return a list of possible packings containing position and direction for each item inside the containers .
public List<Solution> simulate(Container container, List<Item> items) {
        List<Solution> solutions = new ArrayList<>();
        Solution solution = simulator.simulate(container, items);
        solutions.add(solution);
        while (!solution.getRemainingItems().isEmpty()) {
            solution = simulator.simulate(container, solution.getRemainingItems());
            solutions.add(solution);
        }
        return solutions;
    }
public List < Solution > simulate ( Container container , List < Item > items ) { List < Solution > solutions = new ArrayList < > ( ) ; Solution solution = simulator . simulate ( container , items ) ; solutions . add ( solution ) ; while ( ! solution . getRemainingItems ( ) . isEmpty ( ) ) { solution = simulator . simulate ( container , solution . getRemainingItems ( ) ) ; solutions . add ( solution ) ; } return solutions ; }
Simulates packing a list of items into a container, resulting in a list of solutions.
Simulates packing a list of items into a container resulting in a list of solutions .