<commit_before>package com.jakewharton.scalpel;

import android.content.Context;
import android.graphics.Camera;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import java.util.ArrayDeque;
import java.util.Deque;

import static android.graphics.Paint.ANTI_ALIAS_FLAG;
import static android.graphics.Paint.Style.STROKE;
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_POINTER_UP;
import static android.view.MotionEvent.INVALID_POINTER_ID;

/**
 * Renders your view hierarchy as an interactive 3D visualization.
 * <p>
 * Interactions:
 * <ul>
 * <li>Single touch: controls the rotation of the model.</li>
 * <li>Two finger vertical drag: Adjust zoom.</li>
 * <li>Two finger horizontal drag: Adjust layer spacing.</li>
 * </ul>
 */
public class ScalpelFrameLayout extends FrameLayout {
  private static final int TRACKING_UNKNOWN = 0;
  private static final int TRACKING_VERTICALLY = 1;
  private static final int TRACKING_HORIZONTALLY = -1;
  private static final int ROTATION_MAX = 60;
  private static final int ROTATION_MIN = -ROTATION_MAX;
  private static final int ROTATION_DEFAULT_X = -10;
  private static final int ROTATION_DEFAULT_Y = 15;
  private static final float ZOOM_DEFAULT = 0.6f;
  private static final float ZOOM_MIN = 0.33f;
  private static final float ZOOM_MAX = 2f;
  private static final int SPACING_DEFAULT = 25;
  private static final int SPACING_MIN = 10;
  private static final int SPACING_MAX = 100;
  private static final int BORDER_COLOR = 0xFF888888;
  private static final boolean DEBUG = false;

  private static void log(String message, Object... args) {
    Log.d("Scalpel", String.format(message, args));
  }

  private final Rect viewBoundsRect = new Rect();
  private final Paint viewBorderPaint = new Paint(ANTI_ALIAS_FLAG);
  private final Camera camera = new Camera();
  private final Matrix matrix = new Matrix();
  private final int[] location = new int[2];
  private final Deque<View> viewQueue = new ArrayDeque<>();
  private final Deque<Integer> levelQueue = new ArrayDeque<>();

  private final float density;
  private final float slop;

  private boolean enabled;

  private int pointerOne = INVALID_POINTER_ID;
  private float lastOneX;
  private float lastOneY;
  private int pointerTwo = INVALID_POINTER_ID;
  private float lastTwoX;
  private float lastTwoY;
  private int multiTouchTracking = TRACKING_UNKNOWN;

  private float rotationY = ROTATION_DEFAULT_Y;
  private float rotationX = ROTATION_DEFAULT_X;
  private float zoom = ZOOM_DEFAULT;
  private float spacing = SPACING_DEFAULT;

  private int[] visibilities = new int[50];

  public ScalpelFrameLayout(Context context) {
    this(context, null);
  }

  public ScalpelFrameLayout(Context context, AttributeSet attrs) {
    this(context, attrs, 0);
  }

  public ScalpelFrameLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    DisplayMetrics dm = context.getResources().getDisplayMetrics();
    density = dm.density;
    slop = ViewConfiguration.get(context).getScaledTouchSlop();
<commit_msg>Inline single-use local variable.<commit_after>package com.jakewharton.scalpel;

import android.content.Context;
import android.graphics.Camera;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import java.util.ArrayDeque;
import java.util.Deque;

import static android.graphics.Paint.ANTI_ALIAS_FLAG;
import static android.graphics.Paint.Style.STROKE;
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_POINTER_UP;
import static android.view.MotionEvent.INVALID_POINTER_ID;

/**
 * Renders your view hierarchy as an interactive 3D visualization.
 * <p>
 * Interactions:
 * <ul>
 * <li>Single touch: controls the rotation of the model.</li>
 * <li>Two finger vertical drag: Adjust zoom.</li>
 * <li>Two finger horizontal drag: Adjust layer spacing.</li>
 * </ul>
 */
public class ScalpelFrameLayout extends FrameLayout {
  private static final int TRACKING_UNKNOWN = 0;
  private static final int TRACKING_VERTICALLY = 1;
  private static final int TRACKING_HORIZONTALLY = -1;
  private static final int ROTATION_MAX = 60;
  private static final int ROTATION_MIN = -ROTATION_MAX;
  private static final int ROTATION_DEFAULT_X = -10;
  private static final int ROTATION_DEFAULT_Y = 15;
  private static final float ZOOM_DEFAULT = 0.6f;
  private static final float ZOOM_MIN = 0.33f;
  private static final float ZOOM_MAX = 2f;
  private static final int SPACING_DEFAULT = 25;
  private static final int SPACING_MIN = 10;
  private static final int SPACING_MAX = 100;
  private static final int BORDER_COLOR = 0xFF888888;
  private static final boolean DEBUG = false;

  private static void log(String message, Object... args) {
    Log.d("Scalpel", String.format(message, args));
  }

  private final Rect viewBoundsRect = new Rect();
  private final Paint viewBorderPaint = new Paint(ANTI_ALIAS_FLAG);
  private final Camera camera = new Camera();
  private final Matrix matrix = new Matrix();
  private final int[] location = new int[2];
  private final Deque<View> viewQueue = new ArrayDeque<>();
  private final Deque<Integer> levelQueue = new ArrayDeque<>();

  private final float density;
  private final float slop;

  private boolean enabled;

  private int pointerOne = INVALID_POINTER_ID;
  private float lastOneX;
  private float lastOneY;
  private int pointerTwo = INVALID_POINTER_ID;
  private float lastTwoX;
  private float lastTwoY;
  private int multiTouchTracking = TRACKING_UNKNOWN;

  private float rotationY = ROTATION_DEFAULT_Y;
  private float rotationX = ROTATION_DEFAULT_X;
  private float zoom = ZOOM_DEFAULT;
  private float spacing = SPACING_DEFAULT;

  private int[] visibilities = new int[50];

  public ScalpelFrameLayout(Context context) {
    this(context, null);
  }

  public ScalpelFrameLayout(Context context, AttributeSet attrs) {
    this(context, attrs, 0);
  }

  public ScalpelFrameLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    density = context.getResources().getDisplayMetrics().density;
    slop = ViewConfiguration.get(context).getScaledTouchSlop();

{'fraction_non_alphanumeric': 0.08289473684210526, 'fraction_numerical': 0.009941520467836258, 'mean_word_length': 4.928076256499134, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2770425', 'n_tokens_mistral': 2093, 'n_tokens_neox': 1993, 'n_words': 630}