needsSplit = countSplitBalancePerBitA(values, lengthShiftsInBitFormat, lengthShiftGroupFilter, charSeeds, charSeedsDepth, charSeedsGroupFilter, countSpace, mixBits, sigBits); } else { needsSplit = countSplitBalancePerBitB(values, lengthShiftsInBitFormat, lengthShiftGroupFilter, charSeeds, charSeedsDepth, charSeedsGroupFilter, countSpace, mixBits, sigBits); accumulateLargestGroups(countSpace, largeGroupCount); 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 );
private boolean isApplicable(final int mixerShift, final int mixerMask, final int cBitShift, final int cBitsMask, CharSequence value, int length, int[] charSeeds, int charSeedsLength, int charSeedsFilter) { boolean applicable = true; int c = charSeedsLength; while (--c >= 0 && applicable) { int checkSeedBit = 1&(charSeedsFilter>>c);//expecting 1 or 0 applicable &= (checkSeedBit == charSplitBit(mixerShift, mixerMask, cBitShift, cBitsMask, charSeeds[c], value, length)); } return applicable; }
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);
if (filterCheckForLen == (filterMaskForLen & length)) { if (isApplicable(mixerShift, mixerMask, cBitShift, cBitsMask, value, length, charSeeds, charSeedsDepth, charSeedsFilter)) { countSpace[n] += charSplitBit(mixerShift, mixerMask, cBitShift, cBitsMask, n, value, length);
CharSequenceHashBuilder obj = new CharSequenceHashBuilder(); GeneratedHashRules result = obj.perfectCharSequenceHashBuilder(testValues);
CharSequenceHashBuilder obj = new CharSequenceHashBuilder(); GeneratedHashRules result = obj.perfectIntegerHashBuilder(testValues);
if (isValueSelected(value)) {
Arrays.fill(largestGroup, 0); needsMoreSplitting = recursiveBalanceScan(values, shiftsStack, shiftStackDepth, 0, shiftsStackAsBits, charHashSeed, -1, -1, 0, largestGroup, lengthCountSpace, mixBits, sigBits); bitShift = (byte)findIdxOfSmallestGroup(largestGroup, (lastGroupSize>>1)+1, shiftsStackAsBits); needsMoreSplitting = recursiveBalanceScan(values, shiftsStack, shiftStackDepth, 0, shiftsStackAsBits, charHashSeed, charHashSeedDepth, charHashSeedDepth, 0, charLenCountGroups, charLenCountSpace, mixBits, sigBits); int seedIdx = findIdxOfSmallestGroup(charLenCountGroups, lastGroupSize,0);