private boolean recursiveBalanceScan(byte[] shifts, int depth, int primaryMask, int[] values, int base, int[] largeGroupCount, int[] countSpace) { int idx = depth - 1; //System.out.println("idx "+idx+" base "+Integer.toBinaryString(base)); if (idx < 0) { //use this mask and test this case boolean needsMoreSplitting = countSplitBalancePerBit(values, primaryMask, base, countSpace); if (needsMoreSplitting) { accumulateLargestGroups(countSpace, largeGroupCount); } return needsMoreSplitting; //go no deeper } return recursiveBalanceScan(shifts, idx, primaryMask, values, base, largeGroupCount, countSpace) | //with zero for the mask recursiveBalanceScan(shifts, idx, primaryMask, values, base | (1<<shifts[idx]), largeGroupCount, countSpace); //returns true if any group needs to be split more, return false if we are all done }
needsMoreSplitting = recursiveBalanceScan(shiftsStack, shiftStackDepth, accumMask, values, 0, largestGroup, lengthCountSpace); bitIndex = (byte)findIdxOfSmallestGroup(largestGroup, Integer.MAX_VALUE, accumMask);
Arrays.fill(largestGroup, 0); needsMoreSplitting = recursiveBalanceScan(values, shiftsStack, shiftStackDepth, 0, shiftsStackAsBits, charHashSeed, -1, -1, 0, largestGroup, lengthCountSpace, mixBits, sigBits); needsMoreSplitting = recursiveBalanceScan(values, shiftsStack, shiftStackDepth, 0, shiftsStackAsBits, charHashSeed, charHashSeedDepth, charHashSeedDepth, 0, charLenCountGroups, charLenCountSpace, mixBits, sigBits);
recursiveBalanceScan(values, lengthShifts, lengthBitFilter, lengthFilterLeft, lengthShiftsInBitFormat, charSeeds, charSeedsDepth, charSeedFilter, charSeedsGroupFilterLeft,largeGroupCount,countSpace, mixBits, sigBits) recursiveBalanceScan(values, lengthShifts, lengthBitFilter, lengthFitlerRight, lengthShiftsInBitFormat, charSeeds, charSeedsDepth, charSeedFilter, charSeedsGroupFilterRight,largeGroupCount,countSpace, mixBits, sigBits );