test_class.file: androidplot-core/src/test/java/com/androidplot/xy/FastLineAndPointRendererTest.java
test_class.identifier: FastLineAndPointRendererTest
test_class.superclass: extends AndroidplotTest
test_case.body: @Test
      public void testOnRender() throws Exception {
          RectF gridRect = new RectF(5, 5, 105, 105);
          XYPlot plot = new XYPlot(getContext(), "Test");
  
          FastLineAndPointRenderer.Formatter formatter =
                  new FastLineAndPointRenderer.Formatter(Color.RED, Color.RED, null);
  
  
          // create a series composed of 3 "segments"; series portions separated by null values:
          XYSeries series = new SimpleXYSeries(
                  SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, "some data", 1, 2, null, 3, 4, 5, 6, 7, null, null, 8);
  
          FastLineAndPointRenderer renderer = Mockito.spy(new FastLineAndPointRenderer(plot));
          Canvas canvas = mock(Canvas.class);
  
          renderer.onRender(canvas, gridRect, series, formatter, null);
  
          // first segment
          verify(renderer, times(1)).drawSegment(
                  eq(canvas),
                  any(float[].class),
                  eq(0),
                  eq(4),
                  eq(formatter));
  
          verify(canvas, times(1)).drawPoints(
                  any(float[].class),
                  eq(0),
                  eq(4),
                  eq(formatter.getVertexPaint()));
  
          // second segment
          verify(renderer, times(1)).drawSegment(
                  eq(canvas),
                  any(float[].class),
                  eq(6),
                  eq(10),
                  eq(formatter));
  
          verify(canvas, times(1)).drawPoints(
                  any(float[].class),
                  eq(6),
                  eq(10),
                  eq(formatter.getVertexPaint()));
  
          // third segment
          verify(renderer, times(1)).drawSegment(
                  eq(canvas),
                  any(float[].class),
                  eq(20),
                  eq(2),
                  eq(formatter));
  
          verify(canvas, times(1)).drawPoints(
                  any(float[].class),
                  eq(20),
                  eq(2),
                  eq(formatter.getVertexPaint()));
      }
test_case.class_method_signature: FastLineAndPointRendererTest.testOnRender()
test_case.full_signature: @Test public void testOnRender()
test_case.identifier: testOnRender
test_case.invocations: getContext spy mock onRender drawSegment verify times eq any eq eq eq drawPoints verify times any eq eq eq getVertexPaint drawSegment verify times eq any eq eq eq drawPoints verify times any eq eq eq getVertexPaint drawSegment verify times eq any eq eq eq drawPoints verify times any eq eq eq getVertexPaint
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testOnRender()
focal_class.declarator: MINIMUM_NUMBER_OF_POINTS_TO_DEFINE_A_LINE = 4
focal_class.modifier: private static final
focal_class.original_string: private static final int MINIMUM_NUMBER_OF_POINTS_TO_DEFINE_A_LINE = 4;
focal_class.type: int
focal_class.var_name: MINIMUM_NUMBER_OF_POINTS_TO_DEFINE_A_LINE
focal_class.declarator: points
focal_class.modifier: private
focal_class.original_string: private float[] points;
focal_class.type: float[]
focal_class.var_name: points
focal_class.declarator: segmentOffsets = new ArrayList<>()
focal_class.original_string: List<Integer> segmentOffsets = new ArrayList<>();
focal_class.type: List<Integer>
focal_class.var_name: segmentOffsets
focal_class.declarator: segmentLengths = new ArrayList<>()
focal_class.original_string: List<Integer> segmentLengths = new ArrayList<>();
focal_class.type: List<Integer>
focal_class.var_name: segmentLengths
focal_class.file: androidplot-core/src/main/java/com/androidplot/xy/FastLineAndPointRenderer.java
focal_class.identifier: FastLineAndPointRenderer
focal_class.class_method_signature: FastLineAndPointRenderer.FastLineAndPointRenderer(XYPlot plot)
focal_class.full_signature: public  FastLineAndPointRenderer(XYPlot plot)
focal_class.identifier: FastLineAndPointRenderer
focal_class.modifiers: public
focal_class.parameters: (XYPlot plot)
focal_class.signature:  FastLineAndPointRenderer(XYPlot plot)
focal_class.class_method_signature: FastLineAndPointRenderer.onRender(Canvas canvas, RectF plotArea, XYSeries series, Formatter formatter, RenderStack stack)
focal_class.full_signature: @Override protected void onRender(Canvas canvas, RectF plotArea, XYSeries series, Formatter formatter, RenderStack stack)
focal_class.identifier: onRender
focal_class.modifiers: @Override protected
focal_class.parameters: (Canvas canvas, RectF plotArea, XYSeries series, Formatter formatter, RenderStack stack)
focal_class.return: void
focal_class.signature: void onRender(Canvas canvas, RectF plotArea, XYSeries series, Formatter formatter, RenderStack stack)
focal_class.class_method_signature: FastLineAndPointRenderer.drawSegment(@NonNull Canvas canvas,
                                 @NonNull float[] points,
                                 int offset,
                                 int len,
                                 Formatter formatter)
focal_class.full_signature: protected void drawSegment(@NonNull Canvas canvas,
                                 @NonNull float[] points,
                                 int offset,
                                 int len,
                                 Formatter formatter)
focal_class.identifier: drawSegment
focal_class.modifiers: protected
focal_class.parameters: (@NonNull Canvas canvas,
                                 @NonNull float[] points,
                                 int offset,
                                 int len,
                                 Formatter formatter)
focal_class.return: void
focal_class.signature: void drawSegment(@NonNull Canvas canvas,
                                 @NonNull float[] points,
                                 int offset,
                                 int len,
                                 Formatter formatter)
focal_class.class_method_signature: FastLineAndPointRenderer.doDrawLegendIcon(@NonNull Canvas canvas,
                                      @NonNull RectF rect,
                                      @NonNull Formatter formatter)
focal_class.full_signature: @Override protected void doDrawLegendIcon(@NonNull Canvas canvas,
                                      @NonNull RectF rect,
                                      @NonNull Formatter formatter)
focal_class.identifier: doDrawLegendIcon
focal_class.modifiers: @Override protected
focal_class.parameters: (@NonNull Canvas canvas,
                                      @NonNull RectF rect,
                                      @NonNull Formatter formatter)
focal_class.return: void
focal_class.signature: void doDrawLegendIcon(@NonNull Canvas canvas,
                                      @NonNull RectF rect,
                                      @NonNull Formatter formatter)
focal_class.superclass: extends XYSeriesRenderer<XYSeries, FastLineAndPointRenderer.Formatter>
focal_method.body: @Override
      protected void onRender(Canvas canvas, RectF plotArea, XYSeries series, Formatter formatter, RenderStack stack) {
  
          segmentOffsets.clear();
          segmentLengths.clear();
  
          final int numPoints = series.size() * 2;
          if(points == null || points.length != numPoints) {
              // only allocate when necessary:
              points = new  float[series.size()*2];
          }
  
          int segmentLen = 0;
          boolean isLastPointNull = true;
          PointF resultPoint = new PointF();
          for (int i = 0, j = 0;  i < series.size(); i++, j+=2) {
              Number y = series.getY(i);
              Number x = series.getX(i);
  
              if (y != null && x != null) {
                  if(isLastPointNull) {
                      segmentOffsets.add(j);
                      segmentLen = 0;
                      isLastPointNull = false;
                  }
  
                  getPlot().getBounds().transformScreen(resultPoint, x, y, plotArea);
                  points[j] = resultPoint.x;
                  points[j + 1] = resultPoint.y;
                  segmentLen+=2;
  
                  // if this is the last point, account for it in segment lengths:
                  if(i == series.size()-1) {
                      segmentLengths.add(segmentLen);
                  }
              } else if(!isLastPointNull) {
                  segmentLengths.add(segmentLen);
                  isLastPointNull = true;
              }
          }
  
          // draw segments
          if(formatter.linePaint != null || formatter.vertexPaint != null) {
              for (int i = 0; i < segmentOffsets.size(); i++) {
                  final int len = segmentLengths.get(i);
                  final int offset = segmentOffsets.get(i);
                  drawSegment(canvas, points, offset, len, formatter);
              }
          }
      }
focal_method.class_method_signature: FastLineAndPointRenderer.onRender(Canvas canvas, RectF plotArea, XYSeries series, Formatter formatter, RenderStack stack)
focal_method.full_signature: @Override protected void onRender(Canvas canvas, RectF plotArea, XYSeries series, Formatter formatter, RenderStack stack)
focal_method.identifier: onRender
focal_method.invocations: clear clear size size size getY getX add transformScreen getBounds getPlot size add add size get get drawSegment
focal_method.modifiers: @Override protected
focal_method.parameters: (Canvas canvas, RectF plotArea, XYSeries series, Formatter formatter, RenderStack stack)
focal_method.return: void
focal_method.signature: void onRender(Canvas canvas, RectF plotArea, XYSeries series, Formatter formatter, RenderStack stack)