<commit_before>package io.github.cloudiator.rest.converter;

import io.github.cloudiator.rest.model.InstallationRequest;
import org.cloudiator.messages.InstallationEntities;

/**
 * Created by <NAME> on 12.09.2017.
 *
 * converts REST model into protobuf message and vice versa
 */
public class InstallationRequestConverter implements
    TwoWayConverter<InstallationRequest, InstallationEntities.Installation> {

  private final ToolConverter toolConverter = new ToolConverter();
  private final NodeConverter nodeConverter = new NodeConverter();

  @Override
  public InstallationRequest applyBack(InstallationEntities.Installation nstallation) {
    //from protobuf to REST
    throw new UnsupportedOperationException();
  }

  @Override
  public InstallationEntities.Installation apply(InstallationRequest installationRequest) {
    //from REST to protobuf
    InstallationEntities.Installation.Builder builder = InstallationEntities.Installation
        .newBuilder();

    //setting node
    builder.setNode(nodeConverter.apply(installationRequest.getNode()));

    //setting tools
    for (int i = 0; i < installationRequest.getTools().size(); i++) {

      builder.setTool(i, toolConverter.apply(installationRequest.getTools().get(i)));<commit_msg>fixed converter<commit_after>package io.github.cloudiator.rest.converter;

import io.github.cloudiator.rest.model.InstallationRequest;
import io.github.cloudiator.rest.model.Tool;
import org.cloudiator.messages.InstallationEntities;

/**
 * Created by <NAME> on 12.09.2017.
 *
 * converts REST model into protobuf message and vice versa
 */
public class InstallationRequestConverter implements
    TwoWayConverter<InstallationRequest, InstallationEntities.Installation> {

  private final ToolConverter toolConverter = new ToolConverter();
  private final NodeConverter nodeConverter = new NodeConverter();

  @Override
  public InstallationRequest applyBack(InstallationEntities.Installation nstallation) {
    //from protobuf to REST
    throw new UnsupportedOperationException();
  }

  @Override
  public InstallationEntities.Installation apply(InstallationRequest installationRequest) {
    //from REST to protobuf
    InstallationEntities.Installation.Builder builder = InstallationEntities.Installation
        .newBuilder();

    //setting node
    builder.setNode(nodeConverter.apply(installationRequest.getNode()));

    for(Tool tool : installationRequest.getTools()){
      builder.addTool(toolConverter.apply(tool));
{'fraction_non_alphanumeric': 0.08651911468812877, 'fraction_numerical': 0.006841046277665996, 'mean_word_length': 5.123152709359606, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 7, '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': '5664299', 'n_tokens_mistral': 659, 'n_tokens_neox': 628, 'n_words': 149}