/** Add the {@link #top()} slice as well as all slices that are positionned * on the same term to {@code tops} and return how many of them there are. */ int fillTop(TermsEnumWithSlice[] tops) { final int size = size(); if (size == 0) { return 0; } tops[0] = top(); int numTop = 1; stack[0] = 1; int stackLen = 1; while (stackLen != 0) { final int index = stack[--stackLen]; final int leftChild = index << 1; for (int child = leftChild, end = Math.min(size, leftChild + 1); child <= end; ++child) { TermsEnumWithSlice te = get(child); if (te.current.equals(tops[0].current)) { tops[numTop++] = te; stack[stackLen++] = child; } } } return numTop; }
/** Add the {@link #top()} slice as well as all slices that are positionned * on the same term to {@code tops} and return how many of them there are. */ int fillTop(TermsEnumWithSlice[] tops) { final int size = size(); if (size == 0) { return 0; } tops[0] = top(); int numTop = 1; stack[0] = 1; int stackLen = 1; while (stackLen != 0) { final int index = stack[--stackLen]; final int leftChild = index << 1; for (int child = leftChild, end = Math.min(size, leftChild + 1); child <= end; ++child) { TermsEnumWithSlice te = get(child); if (te.current.equals(tops[0].current)) { tops[numTop++] = te; stack[stackLen++] = child; } } } return numTop; }
/** Add the {@link #top()} slice as well as all slices that are positionned * on the same term to {@code tops} and return how many of them there are. */ int fillTop(TermsEnumWithSlice[] tops) { final int size = size(); if (size == 0) { return 0; } tops[0] = top(); int numTop = 1; stack[0] = 1; int stackLen = 1; while (stackLen != 0) { final int index = stack[--stackLen]; final int leftChild = index << 1; for (int child = leftChild, end = Math.min(size, leftChild + 1); child <= end; ++child) { TermsEnumWithSlice te = get(child); if (te.current.equals(tops[0].current)) { tops[numTop++] = te; stack[stackLen++] = child; } } } return numTop; }
/** Add the {@link #top()} slice as well as all slices that are positionned * on the same term to {@code tops} and return how many of them there are. */ int fillTop(TermsEnumWithSlice[] tops) { final int size = size(); if (size == 0) { return 0; } tops[0] = top(); int numTop = 1; stack[0] = 1; int stackLen = 1; while (stackLen != 0) { final int index = stack[--stackLen]; final int leftChild = index << 1; for (int child = leftChild, end = Math.min(size, leftChild + 1); child <= end; ++child) { TermsEnumWithSlice te = get(child); if (te.current.equals(tops[0].current)) { tops[numTop++] = te; stack[stackLen++] = child; } } } return numTop; }