<commit_before>package de.uniulm.omi.cloudiator.lance.lifecycle.language;

import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

//todo: build DockerCommandException
public enum DockerCommands {
  CREATE(new Option[]{Option.NAME, Option.PORT, Option.RESTART, Option.INTERACTIVE, Option.NETWORK, Option.TTY}, new Command[]{Command.BASH}),
  START(new Option[]{Option.INTERACTIVE, Option.NETWORK}, new Command[]{}),
  STOP(new Option[]{}, new Command[]{});

  private final Set<Option> possibleOptions;
  private final Set<Command> possibleCommands;

  private Set<Option> setOption;
  private Command setCommand;
  private List<String> setArgs;

  private DockerCommands(Option[] opts, Command[] commands) {
    possibleOptions = new HashSet<>(Arrays.asList(opts));
    possibleCommands = new HashSet<>(Arrays.asList(commands));
  }

  public static enum Option {
    NAME, PORT, RESTART, INTERACTIVE, NETWORK, TTY;
  }

  public static enum Command {
    BASH
  }

  //todo: include Enum-name (DockerCommands) and Enum-name(Option) in Exception String
  public void setOption(Option opt) throws Exception {
    if(!possibleOptions.contains(opt))
      throw new Exception("Option does not exist for this DockerCommand");

    setOption.add(opt);
  }

  //todo: include Enum-name (DockerCommands) and Enum-name(Option) in Exception String
  public void setCommand(Command cmd) throws Exception {
    if(!possibleCommands.contains(cmd))
      throw new Exception("Command does not exist for this DockerCommand");

   setCommand = cmd;
  }

  public void setArg(String arg) {
    setArgs.add(arg);
  }

  //todo: implement
  public String getSetOptionsString() {
    return null;
  }

  //todo: implement
  public String getSetCommandString() {
    return null;
  }

  //todo: implement
  public String getSetArgsString() {
    return null;
  }
}<commit_msg>Implemented missing methods in DockerCommands<commit_after>package de.uniulm.omi.cloudiator.lance.lifecycle.language;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

//todo: build DockerCommandException
public enum DockerCommands {
  CREATE(new Option[]{Option.NAME, Option.PORT, Option.RESTART, Option.INTERACTIVE, Option.NETWORK, Option.TTY}, new Command[]{Command.BASH}),
  START(new Option[]{Option.INTERACTIVE, Option.NETWORK}, new Command[]{}),
  STOP(new Option[]{}, new Command[]{});

  private final Set<Option> possibleOptions;
  private final Set<Command> possibleCommands;

  private Map<Option, String> setOptions;
  private Command setCommand;
  private List<String> setArgs;

  private DockerCommands(Option[] opts, Command[] commands) {
    possibleOptions = new HashSet<>(Arrays.asList(opts));
    possibleCommands = new HashSet<>(Arrays.asList(commands));

    setOptions = new HashMap<>();
    setArgs = new ArrayList<>();
  }

  public static enum Option {
    NAME, PORT, RESTART, INTERACTIVE, NETWORK, TTY;
  }

  public static enum Command {
    BASH
  }

  //todo: include Enum-name (DockerCommands) and Enum-name(Option) in Exception String
  public void setOption(Option opt, String arg) throws Exception {
    if(!possibleOptions.contains(opt))
      throw new Exception("Option does not exist for this DockerCommand");

    setOptions.put(opt,arg);
  }

  //todo: include Enum-name (DockerCommands) and Enum-name(Command) in Exception String
  public void setCommand(Command cmd) throws Exception {
    if(!possibleCommands.contains(cmd))
      throw new Exception("Command does not exist for this DockerCommand");

   setCommand = cmd;
  }

  public void setArg(String arg) {
    setArgs.add(arg);
  }

  public String getSetOptionsString() {
    StringBuilder builder = new StringBuilder();

    for (Map.Entry<Option, String> kv : setOptions.entrySet()) {
      builder.append(getOptionString(kv.getKey()) + " " + kv.getValue() + " ");
    }
    return builder.toString();
  }

  public String getSetCommandString() {
    return getCommandString(setCommand);
  }

  public String getSetArgsString() {
    StringBuilder builder = new StringBuilder();

    for (String arg: setArgs) {
      builder.append(arg + " ");
    }
    return builder.toString();
  }

  private String getOptionString(Option opt) {
    switch (opt) {
      case NAME:
        return "--name";
      case PORT:
        return "--port";
      case RESTART:
        return "--restart";
      case INTERACTIVE:
        return "--interactive";
      case NETWORK:
        return "--network";
      default:
        return "";
    }
  }

  private String getCommandString(Command cmd) {
    switch (cmd) {
      case BASH:
        return "bash";
      default:
        return "";
    }
  }
}
{'fraction_non_alphanumeric': 0.1163515478911282, 'fraction_numerical': 0.0, 'mean_word_length': 3.7288801571709236, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, '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': '7254428', 'n_tokens_mistral': 1420, 'n_tokens_neox': 1397, 'n_words': 385}