@@ -830,6 +830,14 @@ public static class RangeIterator {
830830 private int runEnd ;
831831 private int logicalPos ;
832832
833+ /**
834+ * Constructs a new RangeIterator for iterating over a range of values in a RunEndEncodedVector.
835+ *
836+ * @param runEndEncodedVector The vector to iterate over
837+ * @param startIndex The logical start index of the range (inclusive)
838+ * @param length The number of values to include in the range
839+ * @throws IllegalArgumentException if startIndex is negative or (startIndex + length) exceeds vector bounds
840+ */
833841 public RangeIterator (RunEndEncodedVector runEndEncodedVector , int startIndex , int length ) {
834842 int rangeEnd = startIndex + length ;
835843 Preconditions .checkArgument (
@@ -847,6 +855,11 @@ public RangeIterator(RunEndEncodedVector runEndEncodedVector, int startIndex, in
847855 this .logicalPos = -1 ;
848856 }
849857
858+ /**
859+ * Advances to the next run in the range.
860+ *
861+ * @return true if there is another run available, false if iteration has completed
862+ */
850863 public boolean nextRun () {
851864 logicalPos = runEnd ;
852865 if (logicalPos >= rangeEnd ) {
@@ -861,6 +874,11 @@ private void updateRun() {
861874 runEnd = (int ) ((BaseIntVector ) runEndEncodedVector .runEndsVector ).getValueAsLong (runIndex );
862875 }
863876
877+ /**
878+ * Advances to the next value in the range.
879+ *
880+ * @return true if there is another value available, false if iteration has completed
881+ */
864882 public boolean nextValue () {
865883 logicalPos ++;
866884 if (logicalPos >= rangeEnd ) {
@@ -872,14 +890,29 @@ public boolean nextValue() {
872890 return true ;
873891 }
874892
893+ /**
894+ * Gets the current run index (physical position in the run-ends vector).
895+ *
896+ * @return the current run index
897+ */
875898 public int getRunIndex () {
876899 return runIndex ;
877900 }
878901
902+ /**
903+ * Gets the length of the current run within the iterator's range.
904+ *
905+ * @return the number of remaining values in current run within the iterator's range
906+ */
879907 public int getRunLength () {
880908 return Math .min (runEnd , rangeEnd ) - logicalPos ;
881909 }
882910
911+ /**
912+ * Checks if iteration has completed.
913+ *
914+ * @return true if all values in the range have been processed, false otherwise
915+ */
883916 public boolean isEnd () {
884917 return logicalPos >= rangeEnd ;
885918 }
0 commit comments