<commit_before>package com.conveyal.r5.streets;

import com.conveyal.r5.common.GeometryUtils;
import com.conveyal.r5.profile.StreetMode;
import com.vividsolutions.jts.geom.Envelope;
import gnu.trove.TIntCollection;
import gnu.trove.list.TIntList;
import gnu.trove.list.array.TIntArrayList;
import org.apache.commons.math3.util.FastMath;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Represents a potential split point along an existing edge, retaining some geometric calculation state so that
 * once the best candidate is found more detailed calculations can continue.
 * We don't yet handle initial and final Splits on the same edge. This can be a problem for Analysis if your
 * starting point is on a long road without intersections. Travel times to other points along that road would be
 * measured by going to the end of the road and back.
 */
public class Split {

    private static final Logger LOG = LoggerFactory.getLogger(Split.class);

    public int edge = -1;
    public int seg = 0; // the segment within the edge that is closest to the search point
    public double frac = 0; // the fraction along that segment where a link should occur
    public int fixedLon; // the x coordinate of the link point along the edge
    public int fixedLat; // the y coordinate of the link point along the edge
    // We must use a long because squaring a typical search radius in fixed-point _does_ cause signed int32 overflow.
    public long distSquared = Long.MAX_VALUE;

    // The following fields require more calculations and are only set once a best edge is found.
    public int distance0_mm = 0; // the accumulated distance along the edge geometry up to the split point
    public int distance1_mm = 0; // the accumulated distance along the edge geometry after the split point
    public int vertex0; // the vertex at the beginning of the chosen edge
    public int vertex1; // the vertex at the end of the chosen edge

    /**<commit_msg>docs(linking): add comment<commit_after>package com.conveyal.r5.streets;

import com.conveyal.r5.common.GeometryUtils;
import com.conveyal.r5.profile.StreetMode;
import com.vividsolutions.jts.geom.Envelope;
import gnu.trove.TIntCollection;
import gnu.trove.list.TIntList;
import gnu.trove.list.array.TIntArrayList;
import org.apache.commons.math3.util.FastMath;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Represents a potential split point along an existing edge, retaining some geometric calculation state so that
 * once the best candidate is found more detailed calculations can continue.
 * We don't yet handle initial and final Splits on the same edge. This can be a problem for Analysis if your
 * starting point is on a long road without intersections. Travel times to other points along that road would be
 * measured by going to the end of the road and back.
 */
public class Split {

    private static final Logger LOG = LoggerFactory.getLogger(Split.class);

    public int edge = -1;
    public int seg = 0; // the segment within the edge that is closest to the search point
    public double frac = 0; // the fraction along that segment where a link should occur
    public int fixedLon; // the x coordinate of the link point along the edge
    public int fixedLat; // the y coordinate of the link point along the edge
    // We must use a long because squaring a typical search radius in fixed-point _does_ cause signed int32 overflow.
    public long distSquared = Long.MAX_VALUE; // squared distance from given point to the split, in meters

    // The following fields require more calculations and are only set once a best edge is found.
    public int distance0_mm = 0; // the accumulated distance along the edge geometry up to the split point
    public int distance1_mm = 0; // the accumulated distance along the edge geometry after the split point
    public int vertex0; // the vertex at the beginning of the chosen edge
    public int vertex1; // the vertex at the end of the chosen edge

    /**
{'fraction_non_alphanumeric': 0.05782652043868395, 'fraction_numerical': 0.00847457627118644, 'mean_word_length': 3.6880841121495327, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '364435', 'n_tokens_mistral': 1082, 'n_tokens_neox': 1037, 'n_words': 532}