test_class.declarator: layoutManager
test_class.modifier: @Mock
test_class.original_string: @Mock
      LayoutManager layoutManager;
test_class.type: LayoutManager
test_class.var_name: layoutManager
test_class.declarator: xyPlot
test_class.modifier: @Mock
test_class.original_string: @Mock
      XYPlot xyPlot;
test_class.type: XYPlot
test_class.var_name: xyPlot
test_class.declarator: typedArray
test_class.modifier: @Mock
test_class.original_string: @Mock
      TypedArray typedArray;
test_class.type: TypedArray
test_class.var_name: typedArray
test_class.declarator: seriesRegistry
test_class.modifier: @Mock
test_class.original_string: @Mock
      XYSeriesRegistry seriesRegistry;
test_class.type: XYSeriesRegistry
test_class.var_name: seriesRegistry
test_class.declarator: bounds = new RectRegion(0, 100, 0, 100)
test_class.original_string: RectRegion bounds = new RectRegion(0, 100, 0, 100);
test_class.type: RectRegion
test_class.var_name: bounds
test_class.file: androidplot-core/src/test/java/com/androidplot/xy/PanZoomTest.java
test_class.identifier: PanZoomTest
test_class.superclass: extends AndroidplotTest
test_case.body: @Test
      public void testZoom() {
          xyPlot = spy(new InstrumentedXYPlot(getContext()));
          xyPlot.setDomainBoundaries(0, 100, BoundaryMode.FIXED);
          xyPlot.setRangeBoundaries(0, 100, BoundaryMode.FIXED);
          xyPlot.redraw();
  
          PanZoom panZoom = spy(new PanZoom(xyPlot, PanZoom.Pan.BOTH, PanZoom.Zoom.SCALE));
  
          // cap our pan/zoom boundaries:
          xyPlot.getOuterLimits().set(0, 100, 0, 100);
  
          panZoom.setFingersRect(new RectF(0, 0, 20, 20));
  
          InOrder inOrder = inOrder(xyPlot);
          inOrder.verify(xyPlot).setDomainBoundaries(0, 100, BoundaryMode.FIXED);
  
          // should result in a 2x zoom on domain centerpoint:
          panZoom.zoom(TestUtils.newPointerDownEvent(0, 0, 40, 40));
          inOrder.verify(xyPlot).setDomainBoundaries(25f, 75f, BoundaryMode.FIXED);
          inOrder.verify(xyPlot).setRangeBoundaries(25f, 75f, BoundaryMode.FIXED);
          inOrder.verify(xyPlot).redraw();
  
          // should result in another 2x zoom on domain centerpoint:
          panZoom.zoom(TestUtils.newPointerDownEvent(0, 0, 80, 80));
          inOrder.verify(xyPlot).setDomainBoundaries(37.5f, 62.5f, BoundaryMode.FIXED);
          inOrder.verify(xyPlot).setRangeBoundaries(37.5f, 62.5f, BoundaryMode.FIXED);
          inOrder.verify(xyPlot).redraw();
  
          // should zoom out and take us back to the original bounds:
          panZoom.zoom(TestUtils.newPointerDownEvent(0, 0, 20, 20));
          inOrder.verify(xyPlot).setDomainBoundaries(0f, 100f, BoundaryMode.FIXED);
          inOrder.verify(xyPlot).setRangeBoundaries(0f, 100f, BoundaryMode.FIXED);
          inOrder.verify(xyPlot).redraw();
  
          // zooming out past capped bounds should not result in any change:
          panZoom.zoom(TestUtils.newPointerDownEvent(0, 0, 1, 1));
          inOrder.verify(xyPlot).setDomainBoundaries(0f, 100f, BoundaryMode.FIXED);
          inOrder.verify(xyPlot).setRangeBoundaries(0f, 100f, BoundaryMode.FIXED);
          // TODO: if nothing changed, then why bother redrawing??
          inOrder.verify(xyPlot).redraw();
  
          // redraw should not be called again
          inOrder.verify(xyPlot, never()).redraw();
  
          // make sure no panning took place during these zoom ops:
          verify(panZoom, never()).pan(any(MotionEvent.class));
  
      }
test_case.class_method_signature: PanZoomTest.testZoom()
test_case.full_signature: @Test public void testZoom()
test_case.identifier: testZoom
test_case.invocations: spy getContext setDomainBoundaries setRangeBoundaries redraw spy set getOuterLimits setFingersRect inOrder setDomainBoundaries verify zoom newPointerDownEvent setDomainBoundaries verify setRangeBoundaries verify redraw verify zoom newPointerDownEvent setDomainBoundaries verify setRangeBoundaries verify redraw verify zoom newPointerDownEvent setDomainBoundaries verify setRangeBoundaries verify redraw verify zoom newPointerDownEvent setDomainBoundaries verify setRangeBoundaries verify redraw verify redraw verify never pan verify never any
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testZoom()
focal_class.declarator: MIN_DIST_2_FING = 5f
focal_class.modifier: protected static final
focal_class.original_string: protected static final float MIN_DIST_2_FING = 5f;
focal_class.type: float
focal_class.var_name: MIN_DIST_2_FING
focal_class.declarator: FIRST_FINGER = 0
focal_class.modifier: protected static final
focal_class.original_string: protected static final int FIRST_FINGER = 0;
focal_class.type: int
focal_class.var_name: FIRST_FINGER
focal_class.declarator: SECOND_FINGER = 1
focal_class.modifier: protected static final
focal_class.original_string: protected static final int SECOND_FINGER = 1;
focal_class.type: int
focal_class.var_name: SECOND_FINGER
focal_class.declarator: plot
focal_class.modifier: private
focal_class.original_string: private XYPlot plot;
focal_class.type: XYPlot
focal_class.var_name: plot
focal_class.declarator: pan
focal_class.modifier: private
focal_class.original_string: private Pan pan;
focal_class.type: Pan
focal_class.var_name: pan
focal_class.declarator: zoom
focal_class.modifier: private
focal_class.original_string: private Zoom zoom;
focal_class.type: Zoom
focal_class.var_name: zoom
focal_class.declarator: zoomLimit
focal_class.modifier: private
focal_class.original_string: private ZoomLimit zoomLimit;
focal_class.type: ZoomLimit
focal_class.var_name: zoomLimit
focal_class.declarator: isEnabled = true
focal_class.modifier: private
focal_class.original_string: private boolean isEnabled = true;
focal_class.type: boolean
focal_class.var_name: isEnabled
focal_class.declarator: dragState = DragState.NONE
focal_class.modifier: private
focal_class.original_string: private DragState dragState = DragState.NONE;
focal_class.type: DragState
focal_class.var_name: dragState
focal_class.declarator: firstFingerPos
focal_class.modifier: private
focal_class.original_string: private PointF firstFingerPos;
focal_class.type: PointF
focal_class.var_name: firstFingerPos
focal_class.declarator: fingersRect
focal_class.modifier: protected
focal_class.original_string: protected RectF fingersRect;
focal_class.type: RectF
focal_class.var_name: fingersRect
focal_class.declarator: delegate
focal_class.modifier: private
focal_class.original_string: private View.OnTouchListener delegate;
focal_class.type: View.OnTouchListener
focal_class.var_name: delegate
focal_class.declarator: state = new State()
focal_class.modifier: private
focal_class.original_string: private State state = new State();
focal_class.type: State
focal_class.var_name: state
focal_class.file: androidplot-core/src/main/java/com/androidplot/xy/PanZoom.java
focal_class.identifier: PanZoom
focal_class.interfaces: implements View.OnTouchListener
focal_class.class_method_signature: PanZoom.PanZoom(@NonNull XYPlot plot, Pan pan, Zoom zoom)
focal_class.full_signature: protected  PanZoom(@NonNull XYPlot plot, Pan pan, Zoom zoom)
focal_class.identifier: PanZoom
focal_class.modifiers: protected
focal_class.parameters: (@NonNull XYPlot plot, Pan pan, Zoom zoom)
focal_class.signature:  PanZoom(@NonNull XYPlot plot, Pan pan, Zoom zoom)
focal_class.class_method_signature: PanZoom.PanZoom(@NonNull XYPlot plot, Pan pan, Zoom zoom, ZoomLimit limit)
focal_class.full_signature: protected  PanZoom(@NonNull XYPlot plot, Pan pan, Zoom zoom, ZoomLimit limit)
focal_class.identifier: PanZoom
focal_class.modifiers: protected
focal_class.parameters: (@NonNull XYPlot plot, Pan pan, Zoom zoom, ZoomLimit limit)
focal_class.signature:  PanZoom(@NonNull XYPlot plot, Pan pan, Zoom zoom, ZoomLimit limit)
focal_class.class_method_signature: PanZoom.getState()
focal_class.full_signature: public State getState()
focal_class.identifier: getState
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: State
focal_class.signature: State getState()
focal_class.class_method_signature: PanZoom.setState(@NonNull State state)
focal_class.full_signature: public void setState(@NonNull State state)
focal_class.identifier: setState
focal_class.modifiers: public
focal_class.parameters: (@NonNull State state)
focal_class.return: void
focal_class.signature: void setState(@NonNull State state)
focal_class.class_method_signature: PanZoom.adjustRangeBoundary(Number lower, Number upper,  BoundaryMode mode)
focal_class.full_signature: protected void adjustRangeBoundary(Number lower, Number upper,  BoundaryMode mode)
focal_class.identifier: adjustRangeBoundary
focal_class.modifiers: protected
focal_class.parameters: (Number lower, Number upper,  BoundaryMode mode)
focal_class.return: void
focal_class.signature: void adjustRangeBoundary(Number lower, Number upper,  BoundaryMode mode)
focal_class.class_method_signature: PanZoom.adjustDomainBoundary(Number lower, Number upper, BoundaryMode mode)
focal_class.full_signature: protected void adjustDomainBoundary(Number lower, Number upper, BoundaryMode mode)
focal_class.identifier: adjustDomainBoundary
focal_class.modifiers: protected
focal_class.parameters: (Number lower, Number upper, BoundaryMode mode)
focal_class.return: void
focal_class.signature: void adjustDomainBoundary(Number lower, Number upper, BoundaryMode mode)
focal_class.class_method_signature: PanZoom.attach(@NonNull XYPlot plot)
focal_class.full_signature: public static PanZoom attach(@NonNull XYPlot plot)
focal_class.identifier: attach
focal_class.modifiers: public static
focal_class.parameters: (@NonNull XYPlot plot)
focal_class.return: PanZoom
focal_class.signature: PanZoom attach(@NonNull XYPlot plot)
focal_class.class_method_signature: PanZoom.attach(@NonNull XYPlot plot, @NonNull Pan pan, @NonNull Zoom zoom)
focal_class.full_signature: public static PanZoom attach(@NonNull XYPlot plot, @NonNull Pan pan, @NonNull Zoom zoom)
focal_class.identifier: attach
focal_class.modifiers: public static
focal_class.parameters: (@NonNull XYPlot plot, @NonNull Pan pan, @NonNull Zoom zoom)
focal_class.return: PanZoom
focal_class.signature: PanZoom attach(@NonNull XYPlot plot, @NonNull Pan pan, @NonNull Zoom zoom)
focal_class.class_method_signature: PanZoom.attach(@NonNull XYPlot plot, @NonNull Pan pan, @NonNull Zoom zoom, @NonNull ZoomLimit limit)
focal_class.full_signature: public static PanZoom attach(@NonNull XYPlot plot, @NonNull Pan pan, @NonNull Zoom zoom, @NonNull ZoomLimit limit)
focal_class.identifier: attach
focal_class.modifiers: public static
focal_class.parameters: (@NonNull XYPlot plot, @NonNull Pan pan, @NonNull Zoom zoom, @NonNull ZoomLimit limit)
focal_class.return: PanZoom
focal_class.signature: PanZoom attach(@NonNull XYPlot plot, @NonNull Pan pan, @NonNull Zoom zoom, @NonNull ZoomLimit limit)
focal_class.class_method_signature: PanZoom.isEnabled()
focal_class.full_signature: public boolean isEnabled()
focal_class.identifier: isEnabled
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isEnabled()
focal_class.class_method_signature: PanZoom.setEnabled(boolean enabled)
focal_class.full_signature: public void setEnabled(boolean enabled)
focal_class.identifier: setEnabled
focal_class.modifiers: public
focal_class.parameters: (boolean enabled)
focal_class.return: void
focal_class.signature: void setEnabled(boolean enabled)
focal_class.class_method_signature: PanZoom.onTouch(final View view, final MotionEvent event)
focal_class.full_signature: @Override public boolean onTouch(final View view, final MotionEvent event)
focal_class.identifier: onTouch
focal_class.modifiers: @Override public
focal_class.parameters: (final View view, final MotionEvent event)
focal_class.return: boolean
focal_class.signature: boolean onTouch(final View view, final MotionEvent event)
focal_class.class_method_signature: PanZoom.fingerDistance(float firstFingerX, float firstFingerY, float secondFingerX, float secondFingerY)
focal_class.full_signature: protected RectF fingerDistance(float firstFingerX, float firstFingerY, float secondFingerX, float secondFingerY)
focal_class.identifier: fingerDistance
focal_class.modifiers: protected
focal_class.parameters: (float firstFingerX, float firstFingerY, float secondFingerX, float secondFingerY)
focal_class.return: RectF
focal_class.signature: RectF fingerDistance(float firstFingerX, float firstFingerY, float secondFingerX, float secondFingerY)
focal_class.class_method_signature: PanZoom.fingerDistance(final MotionEvent evt)
focal_class.full_signature: protected RectF fingerDistance(final MotionEvent evt)
focal_class.identifier: fingerDistance
focal_class.modifiers: protected
focal_class.parameters: (final MotionEvent evt)
focal_class.return: RectF
focal_class.signature: RectF fingerDistance(final MotionEvent evt)
focal_class.class_method_signature: PanZoom.pan(final MotionEvent motionEvent)
focal_class.full_signature: protected void pan(final MotionEvent motionEvent)
focal_class.identifier: pan
focal_class.modifiers: protected
focal_class.parameters: (final MotionEvent motionEvent)
focal_class.return: void
focal_class.signature: void pan(final MotionEvent motionEvent)
focal_class.class_method_signature: PanZoom.calculatePan(final PointF oldFirstFinger, Region bounds, final boolean horizontal)
focal_class.full_signature: protected void calculatePan(final PointF oldFirstFinger, Region bounds, final boolean horizontal)
focal_class.identifier: calculatePan
focal_class.modifiers: protected
focal_class.parameters: (final PointF oldFirstFinger, Region bounds, final boolean horizontal)
focal_class.return: void
focal_class.signature: void calculatePan(final PointF oldFirstFinger, Region bounds, final boolean horizontal)
focal_class.class_method_signature: PanZoom.isValidScale(float scale)
focal_class.full_signature: protected boolean isValidScale(float scale)
focal_class.identifier: isValidScale
focal_class.modifiers: protected
focal_class.parameters: (float scale)
focal_class.return: boolean
focal_class.signature: boolean isValidScale(float scale)
focal_class.class_method_signature: PanZoom.zoom(final MotionEvent motionEvent)
focal_class.full_signature: protected void zoom(final MotionEvent motionEvent)
focal_class.identifier: zoom
focal_class.modifiers: protected
focal_class.parameters: (final MotionEvent motionEvent)
focal_class.return: void
focal_class.signature: void zoom(final MotionEvent motionEvent)
focal_class.class_method_signature: PanZoom.calculateZoom(RectF newRect, float scale, boolean isHorizontal)
focal_class.full_signature: protected void calculateZoom(RectF newRect, float scale, boolean isHorizontal)
focal_class.identifier: calculateZoom
focal_class.modifiers: protected
focal_class.parameters: (RectF newRect, float scale, boolean isHorizontal)
focal_class.return: void
focal_class.signature: void calculateZoom(RectF newRect, float scale, boolean isHorizontal)
focal_class.class_method_signature: PanZoom.getPan()
focal_class.full_signature: public Pan getPan()
focal_class.identifier: getPan
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Pan
focal_class.signature: Pan getPan()
focal_class.class_method_signature: PanZoom.setPan(Pan pan)
focal_class.full_signature: public void setPan(Pan pan)
focal_class.identifier: setPan
focal_class.modifiers: public
focal_class.parameters: (Pan pan)
focal_class.return: void
focal_class.signature: void setPan(Pan pan)
focal_class.class_method_signature: PanZoom.getZoom()
focal_class.full_signature: public Zoom getZoom()
focal_class.identifier: getZoom
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Zoom
focal_class.signature: Zoom getZoom()
focal_class.class_method_signature: PanZoom.setZoom(Zoom zoom)
focal_class.full_signature: public void setZoom(Zoom zoom)
focal_class.identifier: setZoom
focal_class.modifiers: public
focal_class.parameters: (Zoom zoom)
focal_class.return: void
focal_class.signature: void setZoom(Zoom zoom)
focal_class.class_method_signature: PanZoom.getZoomLimit()
focal_class.full_signature: public ZoomLimit getZoomLimit()
focal_class.identifier: getZoomLimit
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: ZoomLimit
focal_class.signature: ZoomLimit getZoomLimit()
focal_class.class_method_signature: PanZoom.setZoomLimit(ZoomLimit zoomLimit)
focal_class.full_signature: public void setZoomLimit(ZoomLimit zoomLimit)
focal_class.identifier: setZoomLimit
focal_class.modifiers: public
focal_class.parameters: (ZoomLimit zoomLimit)
focal_class.return: void
focal_class.signature: void setZoomLimit(ZoomLimit zoomLimit)
focal_class.class_method_signature: PanZoom.getDelegate()
focal_class.full_signature: public View.OnTouchListener getDelegate()
focal_class.identifier: getDelegate
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: View.OnTouchListener
focal_class.signature: View.OnTouchListener getDelegate()
focal_class.class_method_signature: PanZoom.setDelegate(View.OnTouchListener delegate)
focal_class.full_signature: public void setDelegate(View.OnTouchListener delegate)
focal_class.identifier: setDelegate
focal_class.modifiers: public
focal_class.parameters: (View.OnTouchListener delegate)
focal_class.return: void
focal_class.signature: void setDelegate(View.OnTouchListener delegate)
focal_class.class_method_signature: PanZoom.reset()
focal_class.full_signature: public void reset()
focal_class.identifier: reset
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void reset()
focal_class.class_method_signature: PanZoom.getFingersRect()
focal_class.full_signature: protected RectF getFingersRect()
focal_class.identifier: getFingersRect
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: RectF
focal_class.signature: RectF getFingersRect()
focal_class.class_method_signature: PanZoom.setFingersRect(RectF fingersRect)
focal_class.full_signature: protected void setFingersRect(RectF fingersRect)
focal_class.identifier: setFingersRect
focal_class.modifiers: protected
focal_class.parameters: (RectF fingersRect)
focal_class.return: void
focal_class.signature: void setFingersRect(RectF fingersRect)
focal_method.body: protected void zoom(final MotionEvent motionEvent) {
          if (zoom == Zoom.NONE) {
              return;
          }
          final RectF oldFingersRect = getFingersRect();
          final RectF newFingersRect = fingerDistance(motionEvent);
          setFingersRect(newFingersRect);
          if(oldFingersRect == null || RectFUtils.areIdentical(oldFingersRect, newFingersRect)) {
              // zooming gesture has not happened yet so skip:
              return;
          }
          RectF newRect = new RectF();
  
          float scaleX = 1;
          float scaleY = 1;
          switch (zoom) {
              case STRETCH_HORIZONTAL:
                  scaleX = oldFingersRect.width() / getFingersRect().width();
                  if (!isValidScale(scaleX)) {
                      return;
                  }
                  break;
              case STRETCH_VERTICAL:
                  scaleY = oldFingersRect.height() / getFingersRect().height();
                  if (!isValidScale(scaleY)) {
                      return;
                  }
                  break;
              case STRETCH_BOTH:
                  scaleX = oldFingersRect.width() / getFingersRect().width();
                  scaleY = oldFingersRect.height() / getFingersRect().height();
                  if (!isValidScale(scaleX) || !isValidScale(scaleY)) {
                      return;
                  }
                  break;
              case SCALE:
                  float sc1 = (float) Math.hypot(oldFingersRect.height(), oldFingersRect.width());
                  float sc2 = (float) Math.hypot(getFingersRect().height(), getFingersRect().width());
                  float sc = sc1 / sc2;
                  scaleX = sc;
                  scaleY = sc;
                  if (!isValidScale(scaleX) || !isValidScale(scaleY)) {
                      return;
                  }
                  break;
          }
  
          if (EnumSet.of(
                  Zoom.STRETCH_HORIZONTAL,
                  Zoom.STRETCH_BOTH,
                  Zoom.SCALE).contains(zoom)) {
              calculateZoom(newRect, scaleX, true);
              adjustDomainBoundary(newRect.left, newRect.right, BoundaryMode.FIXED);
          }
          if (EnumSet.of(
                  Zoom.STRETCH_VERTICAL,
                  Zoom.STRETCH_BOTH,
                  Zoom.SCALE).contains(zoom)) {
              calculateZoom(newRect, scaleY, false);
              adjustRangeBoundary(newRect.top, newRect.bottom, BoundaryMode.FIXED);
          }
          plot.redraw();
      }
focal_method.class_method_signature: PanZoom.zoom(final MotionEvent motionEvent)
focal_method.full_signature: protected void zoom(final MotionEvent motionEvent)
focal_method.identifier: zoom
focal_method.invocations: getFingersRect fingerDistance setFingersRect areIdentical width width getFingersRect isValidScale height height getFingersRect isValidScale width width getFingersRect height height getFingersRect isValidScale isValidScale hypot height width hypot height getFingersRect width getFingersRect isValidScale isValidScale contains of calculateZoom adjustDomainBoundary contains of calculateZoom adjustRangeBoundary redraw
focal_method.modifiers: protected
focal_method.parameters: (final MotionEvent motionEvent)
focal_method.return: void
focal_method.signature: void zoom(final MotionEvent motionEvent)