All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pdsl.executors.InterpreterObj Maven / Gradle / Ivy

Go to download

The Polymorphic DSL test framework was designed to solve the challenges with testing large, complex systems. Modern architecture requires software to run as distrubited systems or on multiple platforms. The conventional cost of testing these systems is quite high. PDSL allows a user to describe the system under test using a DSL of some kind: a picture, sentences in natural languages, graphs, etc. Using a common DSL allows someone to make deeply scalable tests. A simple change to the DSL could generate dozens of tests providing coverage through many layers of the test pyramid or even multiple applications.

The newest version!
package com.pdsl.executors;

import java.util.Optional;

import com.pdsl.runners.PdslTestParams;
import org.antlr.v4.runtime.tree.ParseTreeListener;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;

/**
 * A container of Visitor/Listener for the Test Case, created for supporting multiple Interpreters (Lexer/Parser; Listener/Visitor)
 * implementation of {@link com.pdsl.runners.PdslTest} annotation; {@link com.pdsl.runners.Interpreter}.
 * The object should contain either a `ParseTreeListener` or `ParseTreeVisitor`.
 */
public final class InterpreterObj {

  private final Optional> parseTreeVisitor;
  private final Optional parseTreeListener;
  private final String startRule;
  public InterpreterObj(ParseTreeVisitor parseTreeVisitor) {
    this.parseTreeVisitor = Optional.of(parseTreeVisitor);
    this.parseTreeListener = Optional.empty();
    this.startRule = PdslTestParams.DEFAULT_ALL_RULE;
  }

  public InterpreterObj(ParseTreeListener parseTreeListener) {
    this.parseTreeVisitor = Optional.empty();
    this.parseTreeListener = Optional.of(parseTreeListener);
    this.startRule = PdslTestParams.DEFAULT_ALL_RULE;
  }

  public InterpreterObj(ParseTreeListener parseTreeListener, String startRule) {
    this.parseTreeVisitor = Optional.empty();
    this.parseTreeListener = Optional.of(parseTreeListener);
    this.startRule = startRule;
  }

  public InterpreterObj(ParseTreeVisitor parseTreeVisitor, String startRule) {
    this.parseTreeVisitor = Optional.of(parseTreeVisitor);
    this.parseTreeListener = Optional.empty();
    this.startRule = startRule;
  }

  public Optional> getParseTreeVisitor(){
    return parseTreeVisitor;
  }

  public Optional getParseTreeListener() {
    return parseTreeListener;
  }
  
  public String getStartRule(){
    return this.startRule;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy