Iterates an array of data points.
| 94 | |
| 95 | /** Iterates an array of data points. */ |
| 96 | public static class MockSeekableView implements SeekableView { |
| 97 | |
| 98 | private final DataPoint[] data_points; |
| 99 | private int index = 0; |
| 100 | |
| 101 | MockSeekableView(final DataPoint[] data_points) { |
| 102 | this.data_points = data_points; |
| 103 | } |
| 104 | |
| 105 | @Override |
| 106 | public boolean hasNext() { |
| 107 | return data_points.length > index; |
| 108 | } |
| 109 | |
| 110 | @Override |
| 111 | public DataPoint next() { |
| 112 | if (hasNext()) { |
| 113 | return data_points[index++]; |
| 114 | } |
| 115 | throw new NoSuchElementException("no more values"); |
| 116 | } |
| 117 | |
| 118 | @Override |
| 119 | public void remove() { |
| 120 | throw new UnsupportedOperationException(); |
| 121 | } |
| 122 | |
| 123 | @Override |
| 124 | public void seek(long timestamp) { |
| 125 | for (index = 0; index < data_points.length; ++index) { |
| 126 | if (data_points[index].timestamp() >= timestamp) { |
| 127 | break; |
| 128 | } |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | public void resetIndex() { |
| 133 | index = 0; |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | /** Generates a sequence of data points. */ |
| 138 | private static class DataPointGenerator implements SeekableView { |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…