<commit_before>package triangulation;

import java.math.BigDecimal;
import java.util.*;

/**
 * Triangulation data structure  "Nodes, ribs и triangles"
 *
 * @author <NAME>
 *         book "Algoritm building and analyse triangulation", A.B.Skvorcov.
 */
public class TriangulationDelaunay {
    // Array of nodes - type: Point
    private final List<Point> nodes = new ArrayList<>();
    // Linked list of triangles
    private final List<TriangleStructure> triangleStructureList = new LinkedList<>();

    private final Stack<FlipStructure> flipBuffer = new Stack<>();

    private class FlipStructure {
        public TriangleStructure triangle;
        public int side;

        public FlipStructure(TriangleStructure triangle, int side) {
            this.triangle = triangle;
            this.side = side;
        }
    }

    public static double AMOUNT_SEARCHER_FACTOR = 0.1D;
    public static double AMOUNT_CLEANING_FACTOR_TRIANGLE_STRUCTURE = 0.1D;
    public static int MINIMAL_POINTS_FOR_CLEANING = 40000;

    private Searcher searcher;

    private class Searcher {
        private TriangleStructure searcher[];
        private double[] elevations;
        private int positionSearcher = 0;

        Searcher(TriangleStructure init, BorderBox box, int amountOfPoints) {
            searcher = new TriangleStructure[(int) Math.max(1.0D, AMOUNT_SEARCHER_FACTOR * Math.sqrt((double) amountOfPoints))];
            for (int i = 0; i < searcher.length; i++) {
                searcher[i] = init;
            }
            double heightStep = (box.getY_max() - box.getY_min()) / (double) searcher.length;
            elevations = new double[searcher.length];
            for (int i = 0; i < elevations.length; i++) {
                elevations[i] = box.getY_min() + i * heightStep;
            }
        }

        TriangleStructure getSearcher() {
            return searcher[positionSearcher];
        }

        public void setSearcher(TriangleStructure searcher) {
            this.searcher[positionSearcher] = searcher;
        }

        public void chooseSearcher(Point point) {
            for (int i = searcher.length - 1; i >= 0; i--) {
                if (point.getY() > elevations[i]) {
                    positionSearcher = i;
                    break;
                }
            }<commit_msg>optimization<commit_after>package triangulation;

import java.math.BigDecimal;
import java.util.*;

/**
 * Triangulation data structure  "Nodes, ribs и triangles"
 *
 * @author <NAME>
 *         book "Algoritm building and analyse triangulation", A.B.Skvorcov.
 */
public class TriangulationDelaunay {
    // Array of nodes - type: Point
    private final List<Point> nodes = new ArrayList<>();
    // Linked list of triangles
    private final List<TriangleStructure> triangleStructureList = new LinkedList<>();

    private final Stack<FlipStructure> flipBuffer = new Stack<>();

    private class FlipStructure {
        public final TriangleStructure triangle;
        public final int side;

        public FlipStructure(TriangleStructure triangle, int side) {
            this.triangle = triangle;
            this.side = side;
        }
    }

    public static double AMOUNT_SEARCHER_FACTOR = 0.1D;
    public static double AMOUNT_CLEANING_FACTOR_TRIANGLE_STRUCTURE = 0.1D;
    public static int MINIMAL_POINTS_FOR_CLEANING = 40000;

    private Searcher searcher;

    private class Searcher {
        private final TriangleStructure[] searcher;
        private final double[] elevations;
        private int positionSearcher = 0;

        Searcher(TriangleStructure init, BorderBox box, int amountOfPoints) {
            searcher = new TriangleStructure[(int) Math.max(1.0D, AMOUNT_SEARCHER_FACTOR * Math.sqrt((double) amountOfPoints))];
            for (int i = 0; i < searcher.length; i++) {
                searcher[i] = init;
            }
            double heightStep = (box.getY_max() - box.getY_min()) / (double) searcher.length;
            elevations = new double[searcher.length];
            for (int i = 0; i < elevations.length; i++) {
                elevations[i] = box.getY_min() + i * heightStep;
            }
        }

        TriangleStructure getSearcher() {
            return searcher[positionSearcher];
        }

        public void setSearcher(TriangleStructure searcher) {
            this.searcher[positionSearcher] = searcher;
        }

        public void chooseSearcher(Point point) {
            for (int i = searcher.length - 1; i >= 0; i--) {
                if (point.getY() > elevations[i]) {
                    positionSearcher = i;
                    break;
                }
            }
{'fraction_non_alphanumeric': 0.09397125080454838, 'fraction_numerical': 0.0068654795108345846, 'mean_word_length': 2.2669936930623686, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '2370942', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1322, 'n_words': 346}