<commit_before>// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.application.options;

import com.intellij.openapi.components.PathMacroMap;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtilRt;
import com.intellij.util.containers.hash.LinkedHashMap;
import gnu.trove.TObjectIntHashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.serialization.PathMacroUtil;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author <NAME>
 *
 * @see PathMacrosImpl#addMacroReplacements(ReplacePathToMacroMap)
 * @see com.intellij.openapi.components.PathMacroManager
 */
public class ReplacePathToMacroMap extends PathMacroMap {
  private List<String> myPathsIndex = null;
  private final Map<String, String> myMacroMap = new LinkedHashMap<>();

  @NonNls public static final String[] PROTOCOLS;
  static {
    List<String> protocols = new ArrayList<>();
    protocols.add("file");
    protocols.add("jar");
    if (Extensions.getRootArea().hasExtensionPoint(PathMacroExpandableProtocolBean.EP_NAME.getName())) {
      for (PathMacroExpandableProtocolBean bean : PathMacroExpandableProtocolBean.EP_NAME.getExtensions()) {
        protocols.add(bean.protocol);
      }
    }
    PROTOCOLS = ArrayUtil.toStringArray(protocols);
  }

  public ReplacePathToMacroMap() {
  }

  @SuppressWarnings("CopyConstructorMissesField")
  public ReplacePathToMacroMap(@NotNull ReplacePathToMacroMap map) {
    for (Map.Entry<String, String> entry : map.myMacroMap.entrySet()) {
      myMacroMap.put(entry.getKey(), entry.getValue());
    }
  }

  public void addMacroReplacement(String path, String macroName) {
    addReplacement(FileUtil.toSystemIndependentName(path), "$" + macroName + "$", true);
  }<commit_msg>cleanup — use putAll<commit_after>// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.application.options;

import com.intellij.openapi.components.PathMacroMap;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtilRt;
import com.intellij.util.containers.hash.LinkedHashMap;
import gnu.trove.TObjectIntHashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.serialization.PathMacroUtil;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author <NAME>
 *
 * @see PathMacrosImpl#addMacroReplacements(ReplacePathToMacroMap)
 * @see com.intellij.openapi.components.PathMacroManager
 */
public class ReplacePathToMacroMap extends PathMacroMap {
  private List<String> myPathsIndex = null;
  private final Map<String, String> myMacroMap = new LinkedHashMap<>();

  @NonNls public static final String[] PROTOCOLS;
  static {
    List<String> protocols = new ArrayList<>();
    protocols.add("file");
    protocols.add("jar");
    if (Extensions.getRootArea().hasExtensionPoint(PathMacroExpandableProtocolBean.EP_NAME)) {
      for (PathMacroExpandableProtocolBean bean : PathMacroExpandableProtocolBean.EP_NAME.getExtensionList()) {
        protocols.add(bean.protocol);
      }
    }
    PROTOCOLS = ArrayUtil.toStringArray(protocols);
  }

  public ReplacePathToMacroMap() {
  }

  @SuppressWarnings("CopyConstructorMissesField")
  public ReplacePathToMacroMap(@NotNull ReplacePathToMacroMap map) {
    myMacroMap.putAll(map.myMacroMap);
  }

  public void addMacroReplacement(String path, String macroName) {
    addReplacement(FileUtil.toSystemIndependentName(path), "$" + macroName + "$", true);
  }
{'fraction_non_alphanumeric': 0.10834312573443008, 'fraction_numerical': 0.004700352526439483, 'mean_word_length': 5.333333333333333, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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': '3320952', 'n_tokens_mistral': 1382, 'n_tokens_neox': 1341, 'n_words': 249}