package com.sourceclear.gramtest;

import org.antlr.v4.runtime.*;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.concurrent.BlockingQueue;

/**
 *
 */
public class TestRunner implements Runnable {

  private ParserRuleContext tree;
  private GeneratorVisitor extractor;
  private BlockingQueue<String> queue;

  TestRunner(InputStream bnfGrammar, BlockingQueue<String> queue) throws IOException {
    Lexer lexer = new bnfLexer(new ANTLRInputStream(bnfGrammar));
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    bnfParser grammarparser = new bnfParser(tokens);
    this.tree = grammarparser.rulelist();
    this.queue = queue;
  }

  public void run() {
    int depth = 1;
    int size = 1;
    while(true) {
      this.extractor = new GeneratorVisitor(depth + size, depth, size, true);
      this.extractor.visit(tree);
      List<String> generatedTests = this.extractor.getTests();
      for (String s: generatedTests)
        try {
          this.queue.put(s);
        } catch (InterruptedException e) {
          e.printStackTrace();
        }
      if((depth + size) % 2 == 0) depth++;
      else size++;
    }
  }

}


@@ -313,16 +313,65 @@
 ractor;%0A
+  private int depth = 2;%0A  private int size = 4;%0A
   privat
@@ -401,16 +401,16 @@
  queue;%0A
-
 %0A  TestR
@@ -746,64 +746,432 @@
 %0A%0A  
-public void run() %7B%0A    int depth = 1;%0A    int size = 1;
+TestRunner(InputStream bnfGrammar, BlockingQueue%3CString%3E queue, int depth, int size) throws IOException %7B%0A    Lexer lexer = new bnfLexer(new ANTLRInputStream(bnfGrammar));%0A    CommonTokenStream tokens = new CommonTokenStream(lexer);%0A    bnfParser grammarparser = new bnfParser(tokens);%0A    this.tree = grammarparser.rulelist();%0A    this.queue = queue;%0A    this.depth = depth;%0A    this.size = size;%0A  %7D%0A%0A  public void run() %7B
 %0A   

Add another constructor