<commit_before>package org.rabix.bindings;

import java.util.List;
import java.util.stream.Collectors;

import org.apache.commons.lang3.StringUtils;
import org.rabix.common.helper.EncodingHelper;

public class CommandLine {

  public static final String PART_SEPARATOR = "\u0020";
  
  private final List<Part> parts;
  
  private final String standardIn;
  private final String standardOut;
  private final String standardError;

  private final boolean runInShell;
  
  public CommandLine(List<Part> parts, String standardIn, String standardOut, String standardError, boolean runInShell) {
    this.parts = parts;
    this.standardIn = standardIn;
    this.standardOut = standardOut;
    this.standardError = standardError;
    this.runInShell = runInShell;
  }

  public String build() {
    StringBuilder builder = new StringBuilder();
   
    for (Part part : parts) {
      builder.append(part.toString()).append(PART_SEPARATOR);
    }
    if (!StringUtils.isEmpty(standardIn)) {
      builder.append(PART_SEPARATOR).append("<").append(PART_SEPARATOR).append(standardIn);
    }
    if (!StringUtils.isEmpty(standardOut)) {
      builder.append(PART_SEPARATOR).append(">").append(PART_SEPARATOR).append(standardOut);
    }
    return normalizeCommandLine(builder.toString());
  }
  
  /**
   * Normalize command line (remove multiple spaces, etc.)
   */
  private String normalizeCommandLine(String commandLine) {
    return commandLine.trim().replaceAll(PART_SEPARATOR + "+", PART_SEPARATOR);
  }
  
  public List<String> getParts() {
    return parts.stream().map(Part::getValue).collect(Collectors.toList());
  }

  public String getStandardIn() {
    return standardIn;<commit_msg>Different way of building command lines<commit_after>package org.rabix.bindings;

import java.util.List;
import java.util.stream.Collectors;

import org.apache.commons.lang3.StringUtils;
import org.rabix.common.helper.EncodingHelper;

public class CommandLine {

  public static final String PART_SEPARATOR = "\u0020";
  
  private final List<Part> parts;
  
  private final String standardIn;
  private final String standardOut;
  private final String standardError;

  private final boolean runInShell;
  
  public CommandLine(List<Part> parts, String standardIn, String standardOut, String standardError, boolean runInShell) {
    this.parts = parts;
    this.standardIn = standardIn;
    this.standardOut = standardOut;
    this.standardError = standardError;
    this.runInShell = runInShell;
  }

  public String build() {
    StringBuilder builder = new StringBuilder();
   
    for (Part part : parts) {
      builder.append(part.toString()).append(PART_SEPARATOR);
    }
    if (!StringUtils.isEmpty(standardIn)) {
      builder.append("<").append(PART_SEPARATOR).append(standardIn).append(PART_SEPARATOR);
    }
    if (!StringUtils.isEmpty(standardOut)) {
      builder.append(">").append(PART_SEPARATOR).append(standardOut);
    }
    return normalizeCommandLine(builder.toString());
  }
  
  /**
   * Normalize command line (remove multiple spaces, etc.)
   */
  private String normalizeCommandLine(String commandLine) {
    return commandLine.trim();//.replaceAll(PART_SEPARATOR + "+", PART_SEPARATOR);
  }
  
  public List<String> getParts() {
    return parts.stream().map(Part::getValue).collect(Collectors.toList());
  }

  public String getStandardIn() {
    return standardIn;
{'fraction_non_alphanumeric': 0.11163614884819846, 'fraction_numerical': 0.0029533372711163615, 'mean_word_length': 4.202764976958525, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '6888735', 'n_tokens_mistral': 993, 'n_tokens_neox': 974, 'n_words': 212}