Groups multiple spans together and offers a dynamic "view" on them. This is used for queries to the TSDB, where we might group multiple Spans that are for the same time series but different tags together. We need to "hide" data points that are outside of the time period of the query and
| 46 | * iterator when using the {@link Span.DownsamplingIterator}. |
| 47 | */ |
| 48 | abstract class AbstractSpanGroup implements DataPoints { |
| 49 | /** |
| 50 | * Finds the {@code i}th data point of this group in {@code O(n)}. |
| 51 | * Where {@code n} is the number of data points in this group. |
| 52 | */ |
| 53 | protected DataPoint getDataPoint(int i) { |
| 54 | if (i < 0) { |
| 55 | throw new IndexOutOfBoundsException("negative index: " + i); |
| 56 | } |
| 57 | final int saved_i = i; |
| 58 | final SeekableView it = iterator(); |
| 59 | DataPoint dp = null; |
| 60 | while (it.hasNext() && i >= 0) { |
| 61 | dp = it.next(); |
| 62 | i--; |
| 63 | } |
| 64 | if (i != -1 || dp == null) { |
| 65 | throw new IndexOutOfBoundsException("index " + saved_i |
| 66 | + " too large (it's >= " + size() + ") for " + this); |
| 67 | } |
| 68 | return dp; |
| 69 | } |
| 70 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…