<commit_before>import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.HashSet;
import java.util.HashMap;
import java.util.Iterator;

class CompositeTask implements CompositeTaskScope {

  private ParseTree parse_tree;
  private Ast ast;
  private WdlSyntaxErrorFormatter error_formatter;
  private Set<String> inputs;
  private String name;

  private class CompositeTaskAstVerifier {
    private WdlSyntaxErrorFormatter syntaxErrorFormatter;

    CompositeTaskAstVerifier(WdlSyntaxErrorFormatter syntaxErrorFormatter) {
      this.syntaxErrorFormatter = syntaxErrorFormatter;
    }

    public Ast verify(AstNode wdl_ast) throws SyntaxError {
      Ast composite_task = null;

      if ( wdl_ast instanceof AstList ) {
        if ( ((AstList) wdl_ast).size() != 1 ) {
          throw new SyntaxError("Composite Task definition should contain only one top level composite_task definition.");
        }

        composite_task = (Ast) ((AstList) wdl_ast).get(0);
      } else if (wdl_ast instanceof Ast) {
        composite_task = (Ast) wdl_ast;
        String node_type = composite_task.getName();
        if (!node_type.equals("CompositeTask")) {
          throw new SyntaxError("TODO");
        }
      } else {
        throw new SyntaxError("TODO");
      }

      /* a)  Error on two 'input' or 'output' in a Step
       * b)  Step names are unique in their scope (global or for)
       * c)  No version specified for task
       * d)  Two outputs have the same name
       */

      AstList ctNodes = (AstList) composite_task.getAttribute("body");
      Set<CompositeTaskNode> nodes = new HashSet<CompositeTaskNode>();

      for ( AstNode ctNode : ctNodes ) {
        Ast node = (Ast) ctNode;
        if (node.getName().equals("Step")) {
          nodes.add(verify_step(ast));
        } else if (node.getName().equals("ForLoop")) {
          nodes.add(verify_for(ast));
        } else if (node.getName().equals("CompositeTask")) {
          nodes.add(verify_composite_task(ast));
        } else {
          throw new SyntaxError("TODO");
        }
      }

      /* Graph definition:
       * 
       * Verticies:
       *    scope, step, variable
       *
       * Edges:
       *    scope -> step           : Step is dependent on scope completing
       *    scope (for) -> variable : Variable is the loop variable (not collection).
       *                              Each for loop contains exactly one of these edges
       *    scope -> scope          : Doesn't exist.
       *    variable -> scope (for) : Variable is the loop collection
       *    variable -> step        : Step needs variable as an input
       *    variable -> variable    : Doesn't exist.
       *    step -> variable        : Variable is an output of step
       *    step -> scope           : Doesn't exist.
       *    step -> step            : Doesn't exist.
       *
       */

      return composite_task;
    }

    private boolean in_scope(CompositeTaskScope scope, CompositeTaskNode node) {
      boolean answer = false;
      for ( CompositeTaskNode scope_node : scope.getNodes() ) {
        answer |= (node == scope_node);
        if ( scope_node instanceof CompositeTaskScope ) {
          answer |= in_scope((CompositeTaskScope) scope_node, node);
        }
      }
      return answer;
    }

    private String variable_to_string(Ast variable) {
      String name;
      Terminal asName = (Terminal) variable.getAttribute("name");
      Terminal asMember = (Terminal) variable.getAttribute("member");
      name = asName.getSourceString();

      if ( false && asMember != null ) {
        name += "." + asMember.getSourceString();
      }
      return name;
    }

    private CompositeTaskNode verify(Ast ast) throws SyntaxError {
      if ( ast.getName().equals("Step") ) {
        return verify_step(ast);
      } else if ( ast.getName().equals("ForLoop") ) {
        return verify_for(ast);
      } else if ( ast.getName().equals("CompositeTask") ) {
        return verify_composite_task(ast);
      } else {
        throw new SyntaxError("TODO");
      }
    }

    private CompositeTaskStep verify_step(Ast step) throws SyntaxError {
      Ast task = (Ast) step.getAttribute("task");
      Terminal task_name = getTaskName(task);
      Terminal task_version = getTaskVersion(task);

      if ( task_version == null ) {<commit_msg>removing unused and unnecessary code<commit_after>import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.HashSet;
import java.util.HashMap;
import java.util.Iterator;

class CompositeTask implements CompositeTaskScope {

  private ParseTree parse_tree;
  private Ast ast;
  private WdlSyntaxErrorFormatter error_formatter;
  private Set<String> inputs;
  private String name;

  private class CompositeTaskAstVerifier {
    private WdlSyntaxErrorFormatter syntaxErrorFormatter;

    CompositeTaskAstVerifier(WdlSyntaxErrorFormatter syntaxErrorFormatter) {
      this.syntaxErrorFormatter = syntaxErrorFormatter;
    }

    public Ast verify(AstNode wdl_ast) throws SyntaxError {
      Ast composite_task = null;

      if ( wdl_ast instanceof AstList ) {
        if ( ((AstList) wdl_ast).size() != 1 ) {
          throw new SyntaxError("Composite Task definition should contain only one top level composite_task definition.");
        }

        composite_task = (Ast) ((AstList) wdl_ast).get(0);
      } else if (wdl_ast instanceof Ast) {
        composite_task = (Ast) wdl_ast;
        String node_type = composite_task.getName();
        if (!node_type.equals("CompositeTask")) {
          throw new SyntaxError("TODO");
        }
      } else {
        throw new SyntaxError("TODO");
      }

      /* a)  Error on two 'input' or 'output' in a Step
       * b)  Step names are unique in their scope (global or for)
       * c)  No version specified for task
       * d)  Two outputs have the same name
       */

      AstList ctNodes = (AstList) composite_task.getAttribute("body");
      Set<CompositeTaskNode> nodes = new HashSet<CompositeTaskNode>();

      for ( AstNode ctNode : ctNodes ) {
        Ast node = (Ast) ctNode;
        nodes.add(verify(ast));
      }

      /* Graph definition:
       * 
       * Verticies:
       *    scope, step, variable
       *
       * Edges:
       *    scope -> step           : Step is dependent on scope completing
       *    scope (for) -> variable : Variable is the loop variable (not collection).
       *                              Each for loop contains exactly one of these edges
       *    variable -> scope (for) : Variable is the loop collection
       *    variable -> step        : Step needs variable as an input
       *    step -> variable        : Variable is an output of step
       *    variable -> variable    : Doesn't exist.
       *    scope -> scope          : Doesn't exist.
       *    step -> scope           : Doesn't exist.
       *    step -> step            : Doesn't exist.
       *
       */

      return composite_task;
    }

    private CompositeTaskNode verify(Ast ast) throws SyntaxError {
      if ( ast.getName().equals("Step") ) {
        return verify_step(ast);
      } else if ( ast.getName().equals("ForLoop") ) {
        return verify_for(ast);
      } else if ( ast.getName().equals("CompositeTask") ) {
        return verify_composite_task(ast);
      } else {
        throw new SyntaxError("TODO");
      }
    }

    private CompositeTaskStep verify_step(Ast step) throws SyntaxError {
      Ast task = (Ast) step.getAttribute("task");
      Terminal task_name = getTaskName(task);
      Terminal task_version = getTaskVersion(task);

      if ( task_version == null ) {
{'fraction_non_alphanumeric': 0.09922779922779923, 'fraction_numerical': 0.0005148005148005148, 'mean_word_length': 2.3309044149164166, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3706411', 'n_tokens_mistral': 2208, 'n_tokens_neox': 2126, 'n_words': 606}