<commit_before>// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.debug.core.model;

import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;

import org.chromium.sdk.Breakpoint;
import org.chromium.sdk.Script;

/**
 * A registry of existing breakpoints associated with their script locations. It
 * is used to restore
 */
public class BreakpointRegistry {

  /**
   * Script identifier for a breakpoint location.
   */
  public static class ScriptIdentifier {
    private final String name;

    private final long id;

    public static ScriptIdentifier forScript(Script script) {
      String name = script.getName();
      return new ScriptIdentifier(name, name != null
          ? -1
          : script.getId());
    }

    private ScriptIdentifier(String name, long id) {
      this.name = name;
      this.id = id;
    }

    @Override
    public int hashCode() {
      final int prime = 31;
      int result = 1;
      result = prime * result + (int) (id ^ (id >>> 32));
      result = prime * result + ((name == null)
          ? 0
          : name.hashCode());
      return result;
    }

    @Override
    public boolean equals(Object obj) {
      if (!(obj instanceof ScriptIdentifier)) {
        return false;
      }
      ScriptIdentifier that = (ScriptIdentifier) obj;
      if (name == null) {
        // an unnamed script, only id is known
        return that.name == null && this.id == that.id;
      }
      // a named script
      return this.name.equals(that.name);
    }
  }

  static class BreakpointLocation {
    private final ScriptIdentifier scriptIdentifier;

    private final int line;

    public BreakpointLocation(ScriptIdentifier scriptIdentifier, int line) {
      this.scriptIdentifier = scriptIdentifier;
      this.line = line;
    }

    public ScriptIdentifier getScriptIdentifier() {
      return scriptIdentifier;
    }

    public int getLine() {
      return line;<commit_msg>Distinguish different scripts from the same resource<commit_after>// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.debug.core.model;

import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;

import org.chromium.sdk.Breakpoint;
import org.chromium.sdk.Script;

/**
 * A registry of existing breakpoints associated with their script locations. It
 * is used to restore
 */
public class BreakpointRegistry {

  /**
   * Script identifier for a breakpoint location.
   */
  public static class ScriptIdentifier {
    private final String name;

    private final long id;

    private final int startLine;

    private final int endLine;

    public static ScriptIdentifier forScript(Script script) {
      String name = script.getName();
      return new ScriptIdentifier(
          name,
          name != null ? -1 : script.getId(),
          script.getStartLine(),
          script.getEndLine());
    }

    private ScriptIdentifier(String name, long id, int startLine, int endLine) {
      this.name = name;
      this.id = id;
      this.startLine = startLine;
      this.endLine = endLine;
    }

    @Override
    public int hashCode() {
      final int prime = 31;
      int result = 1;
      result = prime * result + (int) (id ^ (id >>> 32));
      result = prime * result + ((name == null) ? 0 : name.hashCode());
      result = prime * result + 17 * startLine + 19 * endLine;
      return result;
    }

    @Override
    public boolean equals(Object obj) {
      if (!(obj instanceof ScriptIdentifier)) {
        return false;
      }
      ScriptIdentifier that = (ScriptIdentifier) obj;
      if (this.startLine != that.startLine || this.endLine != that.endLine) {
        return false;
      }
      if (name == null) {
        // an unnamed script, only id is known
        return that.name == null && this.id == that.id;
      }
      // a named script
      return this.name.equals(that.name);
    }
  }

  static class BreakpointLocation {
    private final ScriptIdentifier scriptIdentifier;

    private final int line;

    public BreakpointLocation(ScriptIdentifier scriptIdentifier, int line) {
      this.scriptIdentifier = scriptIdentifier;
      this.line = line;
    }

    public ScriptIdentifier getScriptIdentifier() {
      return scriptIdentifier;
    }

    public int getLine() {
      return line;
{'fraction_non_alphanumeric': 0.09441517386722866, 'fraction_numerical': 0.005479452054794521, 'mean_word_length': 2.6036446469248293, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '263822', 'n_tokens_mistral': 1318, 'n_tokens_neox': 1261, 'n_words': 436}