src/main/java/dev/rsoliveira/tools/binpacking/simulation/PalletPackingSimulation.java
/**
     * The packing flow execution. It's used while iterating the defined axes for both
     * container and items, and to recover the best packing solution.
     * @param state the packing state.
     * @param packedy how much of the container's y axis is used.
     * @param orientation the container orientation.
     */
The packing flow execution. It's used while iterating the defined axes for both
container and items, and to recover the best packing solution.
@param state the packing state.
@param packedy how much of the container's y axis is used.
@param orientation the container orientation.
The packing flow execution . It ' s used while iterating the defined axes for both container and items and to recover the best packing solution . @param state the packing state . @param packedy how much of the container ' s y axis is used . @param orientation the container orientation .
private void iterationCore(PalletPackingState state, long packedy, Volume orientation) {
        long prepackedy;
        long preremainpy;
        do {
            state.setLayerInLayer(0);
            state.setLayerDone(false);
            packLayer(state, orientation, packedy);
            packedy += state.getLayerThickness();
            state.setMaxAvailableThickness(orientation.getDimension2() - packedy);
            if (state.getLayerInLayer() != 0) {
                prepackedy = packedy;
                preremainpy = state.getMaxAvailableThickness();
                state.setMaxAvailableThickness(state.getLayerThickness() - state.getPreLayer());
                packedy = packedy - state.getLayerThickness() + state.getPreLayer();
                state.setRemainpz(state.getLayerInLayerZ());
                state.setLayerThickness(state.getLayerInLayer());
                state.setLayerDone(false);
                packLayer(state, orientation, packedy);
                packedy = prepackedy;
                state.setMaxAvailableThickness(preremainpy);
                state.setRemainpz(orientation.getDimension3());
            }
            findLayer(state, orientation, state.getMaxAvailableThickness());
        } while (state.isPacking());
    }
private void iterationCore ( PalletPackingState state , long packedy , Volume orientation ) { long prepackedy ; long preremainpy ; do { state . setLayerInLayer ( 0 ) ; state . setLayerDone ( false ) ; packLayer ( state , orientation , packedy ) ; packedy += state . getLayerThickness ( ) ; state . setMaxAvailableThickness ( orientation . getDimension2 ( ) - packedy ) ; if ( state . getLayerInLayer ( ) != 0 ) { prepackedy = packedy ; preremainpy = state . getMaxAvailableThickness ( ) ; state . setMaxAvailableThickness ( state . getLayerThickness ( ) - state . getPreLayer ( ) ) ; packedy = packedy - state . getLayerThickness ( ) + state . getPreLayer ( ) ; state . setRemainpz ( state . getLayerInLayerZ ( ) ) ; state . setLayerThickness ( state . getLayerInLayer ( ) ) ; state . setLayerDone ( false ) ; packLayer ( state , orientation , packedy ) ; packedy = prepackedy ; state . setMaxAvailableThickness ( preremainpy ) ; state . setRemainpz ( orientation . getDimension3 ( ) ) ; } findLayer ( state , orientation , state . getMaxAvailableThickness ( ) ) ; } while ( state . isPacking ( ) ) ; }
The packing flow execution.
The packing flow execution .