<commit_before>package com.mikesamuel.cil.format;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.mikesamuel.cil.parser.SourcePosition;

/**
 * Relates characters in source files to characters in a file derived from them.
 *
 * @see <a href="http://www.ibm.com/support/knowledgecenter/SS3JHP_6.1.0/com.ibm.install.raav6006.doc/topics/com12.html">Source Line Mapping File</a>
 */
public final class PositionMapping {
  /**
   * The entries in the mapping.
   * Each entry's derived file range should be
   * disjoint with each other entry's.
   */
  public final ImmutableList<Entry> entries;

  /** */
  public PositionMapping(Iterable<? extends Entry> entries) {
    this.entries = ImmutableList.copyOf(entries);
  }

  /**
   * A relationship between a contiguous sequence of characters in an input
   * and a contiguous sequence of characters in an output derived from it.
   */
  public static final class Entry {
    /** A range of characters in the source file. */
    public final SourcePosition positionInOriginal;
    /**
     * Inclusive character index into the derived output of the start of the
     * range derived from positionInOriginal.
     */
    public final int startIndexInDerived;
    /**
     * Exclusive character index into the derived output of the end of the
     * range derived from positionInOriginal.
     */
    public final int endIndexInDerived;

    /** */
    public Entry(<commit_msg>added TODO<commit_after>package com.mikesamuel.cil.format;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.mikesamuel.cil.parser.SourcePosition;

/**
 * Relates characters in source files to characters in a file derived from them.
 *
 * @see <a href="http://www.ibm.com/support/knowledgecenter/SS3JHP_6.1.0/com.ibm.install.raav6006.doc/topics/com12.html">Source Line Mapping File</a>
 */
public final class PositionMapping {
  /**
   * The entries in the mapping.
   * Each entry's derived file range should be
   * disjoint with each other entry's.
   */
  public final ImmutableList<Entry> entries;

  /** */
  public PositionMapping(Iterable<? extends Entry> entries) {
    // TODO: sort and merge adjacent entries.
    this.entries = ImmutableList.copyOf(entries);
  }

  /**
   * A relationship between a contiguous sequence of characters in an input
   * and a contiguous sequence of characters in an output derived from it.
   */
  public static final class Entry {
    /** A range of characters in the source file. */
    public final SourcePosition positionInOriginal;
    /**
     * Inclusive character index into the derived output of the start of the
     * range derived from positionInOriginal.
     */
    public final int startIndexInDerived;
    /**
     * Exclusive character index into the derived output of the end of the
     * range derived from positionInOriginal.
     */
    public final int endIndexInDerived;

    /** */
    public Entry(
{'fraction_non_alphanumeric': 0.08930356547817395, 'fraction_numerical': 0.006664445184938354, 'mean_word_length': 3.3008595988538683, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6887468', 'n_tokens_mistral': 851, 'n_tokens_neox': 817, 'n_words': 288}